Skip to main content

Full text of "Nuts And Volts"

See other formats


June 2004 

M5Volt3.COM 


Ghee 


WL^SjM 






1 

Mw 


H 




Executing 65,000 lines of Basic code per second the BasicX-24 
is the KING of Basic programmable microcontrollers. 


Ibgram area. 

[with 8 lOBit ADC's, 
asking and Serial UARTs. 


Siteplayer is a true stand-ale 


Super easy to use. 

Standard RJ-45 network interface. 

Control of monitor anything c^r the web. 


High quality serial 2x16 LCD with backlight 


Easy to use. 

2400 & 9600 Baud support 

Software controllable backlight and contrast. 




14VAC, IkVAXfmr 

♦ 120VAC input, 

1 4VAC output @ 1 kVA 

♦ Shipweight-abt.26lbs. 


Screw primary, hvy lugged sec. leads 
New, HSC 90-day warranty 

HSC#19986 $45.00! 


Internet TV Appliance! 


easy hook up! 
arranty 

HSC# 20027 $29.95! 


Wireless Optical Mouse! 

♦ Memorex 'ScrollPro' model, RF-type 

♦ USB-type (PS/2 to USB adapter ind.) 

♦ Optical technology = precise tracking 
n included, 

ties! 

HSC#20055 $14.95! 


Lighted PS/2 Keyboard! 


keyboard w/backlighting! 
► Draws power through PS/2 < 


Keypad + Display 

► 1 6 button keypad w/display 


♦ Single +5VDC supply 

♦ 26 cond. ribbon cable w/lDC conn. 

♦ Display data sheet @ www.halted. 
onlineresources.html 


Ultrasonic Transducer! 

♦ Similar to SonaSwitch 

♦ Mounts in 1.575” hole!! 

♦ Fixed range: 5-7 feet. 


o 


$8.95! 


♦ Three hits to ti 

♦ See ‘http://www.edpcompany’ for info. 

♦ HSC 90-day warranty 

HSC#19833 $9.95! 


Audio/Video Modulator 


♦ Blonder-Tongue Model No. MVAM-s 

♦ 50 - 440 MHz range, 1 9” rack mount 

♦ Adj. video, audio, aural, audio in 

♦ Audio/video overmod LEDs, *P conns. 

♦ 110VAC, UL listed, used, 30-day warr. 

HSC#19641 $19.95! 


Wireless Video System! 

♦ Tiny 3/4 in. color camera w/transmitter! 

♦ Receiver is tuneable for best signal 

♦ 9VDC batt. conn, for portable c 

♦ AC power packs for both units! 

♦ RCA plugs for AA/c 




i 


HSC#80748 $79.95! 


Color Touch Screen! 

♦ ALPS LFH8P4032E 

♦ 240x320 diag. LCD STN I 

display w/CCFL backlight 

♦ 4-wire touchscreen intfce. Special!... 


Blowout Specials!!.. 


$39.95! 


Dot Matrix Display 


► ‘Optrex’ Model No. DMC-16106A 


HSC#19988 


$7.50! 


1 

9.1GB Ultra SCSI 

HSC#1 8753 $14.00! 

m 

AC only VHS Player 

#19152 $10.00! 


#19437 $9.00! 


© 


Buy Now Prices!! #19267 $10.00 



NiMH Battery Charger! 

♦ Charges 2 or 4 AA or AAA sizes. 

♦ Auto selects proper charge current 

♦ Front/rear compartment LED inc 

♦ 4, 2000mAh batts included! 

♦ For 11 0VAC use 

♦ Great for digital cameras! 

♦ New, 90-day warranty 

HSC#80746 $12.50! 


4” Color LCD Monitor! 

♦ Model PCM-4NP 4” TFT LCD 
♦Great for long road trips, security.. .etc. 

♦ Std 3.58MHz NTSC & 4.33MHz PAL 

♦ Built-in speaker, side-mtd display cntrls 

♦ AC & DC pwr. supplies incl. I J 

♦ Comes with cables & stands | 

HSC#80750 V $79.95! 


12 V DC, 3 . 4 A Supply 

♦ ‘CopperCom’ AC/DC adapter 

♦ Input: 120V AC, 60Hz,70W 

♦ Output: 12VDC@3.4A WV 
(-1 6.3VDC unloaded) 

♦ 'Desktop’-style package - many uses 

♦ New units, OEM pkg (plain white box) 


HSC#19312 


$9.95! 


4-Bay SCSI Enclosure 

♦ High quality cabinet 

♦ Extra cooling fan 

♦ 200 W fan-cooled supply I 

♦ Std. D25 rear panel conn. | — 

♦ SCSI ID switch included i 

♦ New, HSC 90-day warranty 

HSC#19703 $24.95 


18 GB SCA SCSI 

♦ Seagate ‘Cheetah’ Ultra -2 Wide 

♦ Formatted Capacity: 1 8.21GB 

♦ Speed: 10, 000RPM 

♦ HSC 90-day warranty 


& 


‘SCS3700’ SCA to SCS1 1 adapter 
Reg. $12.50— for $7.50 w/this drive! 

HSC#19781 $19.95! 


2 U Rack Cabinet 

♦ Includes std. 300W ATX power supply 

♦ ATX M/B compatible 

♦ 4 - 60mm cooling fans!! 

♦ Quality construction 

♦ Drive mtg.hdwr not incl 

♦ Front/rear panel slots, 3 switches, LED 

♦ New, HSC 90-day warranty 

HSC#19848 $39.95! 


External Hard Drive 
Systems! 

Uses PC parallel port - Drives not Incl. 

► ’Datafab’ “Mobile Disk” MD-2 


DirectTV Satellite Dish \ 

♦ Winegard Model No. ‘WG18DUAL’ 


♦ Boxed, w/cables, for DOS, Win95+ 

HSC#19975 $19.95! 

♦ ’H45’ “QuickDrive” 

♦ For 3.5” IDE drives 

♦ For DOS, W95+ 

♦ Boxed.w/diskettes&cabli — 

HSC#19976 $19.95! 

\/ICIA option interface ^ ^ I 

HSC#1 9976 system 

HSC#19995 $9.95! | 


♦ Calif. Amplifier LMB 

♦ 12.2 -12.7GHz in, 
950- 1450MHz out 


♦ New units, w/all hdwr, 90-day warranty 

HSC# 201 61 $24.95! | 




Pen Tablet Computer! \ 

♦ Fujitsu ‘Stylistic 1 000’, 486DX1 00 

♦ SIO, PIO, 2-PCMCIA slots, 1 e x^nde d 
for PCMICA HD (not incl) 

♦ Mobile pwr supply incl. 

| ♦ Great for controller, terminal.. .etc! 

► New units, 90-day warranty 

HSC# 20028 $29.95! | 


/rr^mSBSW 

3 Retail/Wholesale Locations: 

Main Office - Mail Orders... 

Ryder St. Santa Clara, CA 95051 
a Clara 1-408-732-1573 

amento 1-916-338-2545 

Rohnert Park 1-707-585-7344 


Since 1963!... 


Silicon Valley’s Electronic Marketplace 


etfV 


["^"i 


shipping. Orders under $20.00 s 
All orders shipped by UPS Surfaci 
d for COD. Visit our website ft 


JUNE 2004 



TETSUJlKl 200-4 


www.servomagazine.'com 

Enter the competition! 


Man joins Machine 
in a test of 
Imagination, 
Physical Strength, 
ancfMenfal Agility. 


October 21-23 
Santa Clara, CA 


Answer the challenge of Tetsujin 2004 today! 

Every so often, a challenge comes along that is just too good to pass up. If matching 
your skills and ideas against those of the brightest minds in a competition that is sure 
to test the limits of technology and imagination gets your hydraulic fluid pumping, 
then you’ll want to be involved. TETSUJIN 2004 is just such an ^vent. A cross between 
Robot Wars, Monster Garage, and the DARPA Grand Challenge, TETSUJIN 2004 requires 
competitors who know how to think outside the box. 

Held in cor^u^tion with RoboNexus, Tetsujin is already attracting thejattentiOT of 

If you’ are even considering competing, send an email to 


^ jj$r academic affiliation (if any), location (city & state), and 

means of contact (Email, phone). 

We’ll add you to our Email list to keep you informed of event info, updates, and 

f ' v> .» pr jts / 



The Challenge 

Build a powered, articulated exoskeleton 
for a human operator capable of lifting a 
load of from 100 to 720 kg from the 
ground to a maximum height of 1 meter 
and returning the load to 
the ground in a controlled manner. 

Who can participate? 

Schools, Individuals, Industry, Military, 
Private Parties, Robot Clubs, etc. 

What do I need to compete? 

Knowledge of control systems 
Mechanical design 
Welding 

Material selection 
Electronics 

Hydraulics / pneumatics 
Motors and gearing 
Software 
Imagination 
Ingenuity 


What’s in it for me? 

Gain prestige and recognition by indus- 
try and academic institutions. 

Develop a technology that could be 
used for helping the disabled. 

Spotlight your talent and skills to 
corporate headhunters. 

Win cash and prizes totalling 
$25,000.00. 

Be showcased in the pages and on the 
cover of SERVO Magazine. 

Push your limits by doing something that 
hasn’t been done before. 

Important Submission Deadlines 

June 14th - Entry forms 

August 16th - Photos and documentation 

September 27th - Operational video 


) RoboNexus 




PROJECTS 


4 2 DIGITAL SINE WAVES 

Programmatically generate waves up 
to 100 kHz through serial control. 

by Tom Napier 

48 THE ENIGMA MACHINE 

Part 1 : An introduction to the theory 
behind this high voltage apparatus. 

by Gerard Fonte 

53 ANALOG SINE WAVES 

Use the ICL8038 function generator chip 
to fashion a useful benchtop tool! 

by Paul Florian 

FEATURES 


COLUMNS 


! o NEAR SPACE 

Choosing the right data logger. 

] 6 JUST FOR STARTERS 

Starting a new design. Part 1 : Architecture 
and implementation. 

2 i PERSONAL ROBOTICS 

Hack R/C cars for robotics control. 

2 8 ELECTRONICS Q&A 

All About Relays; Low Power and Low 

Voltage Operation; Sidacs Defined; 

Two Projects on the Lighter Side; and more. 


5 8 LEARNING DSP WITH MATLAB 

Experiment with digital signal processing 
with a free copy of Matlab and your PC 
sound card. 

by Jeremy Clark 

60 WORKING WITH DIGITAL FILTERS 

Design and build a digital filter — even if 
you aren't a mathematician. 

by Peter Best 

THE NEXT GENERATION IN COMPETITION: 

4 TETSUJIN 2004 

Details about the cutting edge event 
sponsored by our sister publication, 

SERVO Magazine. 

DEPA R T M E N T S 


97 Advertiser's Index 

69 Classified Display Ads 

20 Electro-Net 

56 Electronics Showcase 

36 New Product News 


74 STAMP APPLICATIONS 

Drumming up control. 

8 0 OPEN COMMUNICATION 

— Spread spectrum radio and CDMA cell 
phones. 

85 TECHKNOWLEDGEY 2004 

Electricity from Sewage; 2.5 GHz PCB; 
Swiss Army Knife Memory; and more. 

8 8 IN THE TRENCHES 

— For design engineers facing real world 
problems. This month: Statistics, Part 2. 


Nuts & Volts (ISSN 1528-9885/CDN Pub Agree#40702530) is published monthly for 
$24.95 per year byT & L Publications, Inc., 430 Princeland Court, Corona, CA 92879. 
PERIODICALS POSTAGE PAID AT CORONA CA AND AT ADDITIONAL MAILING 
OFFICES. POSTMASTER: Send address changes to Nuts & Volts, 430 Princeland 
Court, Corona, CA 92879- 1 300 or Station A, RO. Box 54, Windsor ON N9A $5, 
cpcretumsSinutsvolts .com 


72 News Bytes 

40 NV Bookstore 

_9 Publisher's Info 

_8 Reader Feedback 

93 Tech Forum 


6 


JUNE 2004 




GW-2400SA 

*379.95 


2.4 Ghz Wireless 
Monitor / Camera 


VT-75 

* 129.95 


1/3” Color Dome 
Camera. 

420TVL/0.5 LUX 


MB-1250U 

mm 


1/4" Color Micro Board 
Camera. 


DVC-PR0140 

$ 99.95 


4 Camera PCI Card 

View Up to 16 Cameras 
Using Your PC! 

(With All 4 Cards Installed) 






VPD-01 

$ 119.95 


Vandal Proof Color 
Dome - 360 TVL 
2.0 LUX 



Oi 

Polarns Industries, liic. 


Circle #73 on the Reader Service Card. 



31 58 Process Drive • Norcross, GA • 30071 

Over 1000 Products! • 21 Years of Excellence 

Security Cameras . Lenses . Packages . Wireless . DVRs . Monitors . Cables 


J 












Nuts &VOLTS 


MaxStream" 

Wireless Modems 

have what WiFi, 
Bluetooth & other 
RF solutions do not... 


RANGE 


Best 


Maximize 
Ydur Range 

With up to -1 14 dBm receiver 
sensitivity, MaxStream has up to 
64 times the range of WiFi and 
Bluetooth, and up to 8 times the 
range of competing RF solutions. 

Lgng Range 
At Law Pgwer 

MaxStream’s output power hits 
a sweet spot for long range and 
low power consumption while 
outperforming many 1 Watt radios. 


$ 


Lgng Range 
Fgr Lgw Cost 

With wireless solutions under 
$50, MaxStream is the long range 
leader offering FCC-approved, 
high performance for lower cost 
than competing RF solutions. 



MaxStream » 
The long range leader.™ 



Reader Feedback 


Dear Nuts & Volts, 

I want to thank you for your 
excellent articles. I am a transfer 
subscription from Poptronics. I never 
knew your publication even existed 
until that point. In that way, I'm glad 
things happened the way they did. I 
especially like the columns “Q & A,” 
“Just for Starters,” and “Stamp 
Applications.” Keep up the good work 
and I will keep learning from you. 

Ken Burch 
Deer Lodge, MT 

Dear Nuts & Volts, 

In the April 2004 issue, on page 
16, Louis Frenzel states. " Of course, 
all satellite TV has always been 
digital." This is not true, since the best 
picture quality on satellite TV is 
analog. 

Jim 

via Internet 

Jim is correct that I was wrong. 
I was thinking about modern 
satellite TV, as it is today. It is 
indeed digital. Of course, the old 
satellite TV of the 1980s that 
everyone tried to steal from C band 
satellites with 15-foot dishes was 
analog, but I certainly don't agree 
that the quality of that was better 
than the digital TV of today. 

Louis Frenzel 

Dear Nuts & Volts, 

As a footnote to my article in the 
January Nuts & Volts describing a 
HV supply for G-M tubes, I’ve found an 
easy way to measure up to 2,000 V. 
Apart from a plastic case, a battery, 
an on/off switch, and two banana 
sockets, you’ll need only three 
components. One is a 1,000 MQ, 1.5 
W, 1% thin-film resistor. Digi-Key 
sells it as their 
part SM104F- 
1000M for 

$4.54. 

Another is a 
100K 1% 

resistor you 
can find at 
RadioShack. 

The indicating 
device is one 


Announcing Our New Area Code 

As of July 17, our area code will change 
from (909) to (95 l).This will affect both 
our phone and FAX numbers. 


of those little 3-1 /2 digit panel meters 
that run from a 9 V battery. This has 
an input scale of 200 mV and an input 
leakage of 1 picoamp. You can pick 
one up from All Electronics as catalog 
#PM-200 for $7.00. 

The schematic below shows how 
to wire things together. The result is a 
meter that indicates in volts up to 
1,999 V and takes at most 2 |iA from 
the source. Be careful to handle the 
high-value resistor only by its leads — 
the last thing it needs is fingerprints 
causing surface leakage. Nothing you 
try to clean it with is likely to improve 
on the manufacturer’s treatment. 

With this meter, my HV generator’s 
output drops about 10 V at high 
counting rates. This isn’t enough to 
matter in most cases, but does 
suggest running at a higher repetition 
rate when measuring high dose rates. 

Tom Napier 
North Wales, PA 



ERRATA 

Many of you have wondered how columnist James 
Antonakos calculated the travel time of light through his 
100 meter fiber optic cable. We apologize for omitting the 
equation explaining this 498 ns calculation on page 9 of 
the May, 2004 issue. — Editor Dan 


100m 


TfibCr (i).61%x\{fml s) 


100 m 


- = 498 ns 


JUNE 2004 





Published Monthly By 

T & L Publications, Inc. 

430 Princeland Ct, Corona, CA 92879- 1 300 

(909) 371-8497 
FAX (909) 371-3052 
www.nutsvolts.com 

Subscription Urder uNLr Line 

1-800-783-4624 

FOUNDER/ASSOCIATE PUBLISHER 

Jack Lemieux 

PUBLISHER 

Larry Lemieux 

publisher@nutsvolts.com 

ASSOCIATE PUBLISHER/ 

VP OF SALES/MARKETING 

Robin Lemieux 

robin@nutsvolts.com 

ADVERTISING SALES DIRECTOR 

Rich Collins 

rich@nutsvolts.com 

MANAGING/TECHNICAL EDITOR 

Dan Danknick 

dan@nutsvolts.com 

ASSOCIATE EDITOR 

Alexandra Lindstrom 

alexa@nutsvolts.com 

CONTRIBUTING EDITORS 


Jeremy Clark 
Peter Best 
Mark Balch 
Louis Frenzel 
Jeff Eckert 
Jon Williams 


Gerard Fonte 
Tom Napier 
Paul Florian 
TJ Byers 
Paul Verhage 


CIRCULATION DIRECTOR 

Mary Descaro 

subscribe@nutsvolts.com 

SHOW COORDINATOR 

Audrey Lemieux 

WEB CONTENT/NV STORE 

Michael Kaudze 

michael@nutsvolts.com 


DATA ENTRY 

Janessa Emond 
Kristan Rutz 


All advertising is subject to publisher's approval. We 
are not responsible for mistakes, misprints, or 
typographical errors. Nuts & Volts Magazine assumes 
no responsibility for the availability or condition of 
advertised items or for the honesty of the 
advertiser. The publisher makes no claims for the 
legality of any item advertised in Nuts & Volts . This is 
the sole responsibility of the advertiser. Advertisers 
and their agencies agree to indemnify and protect 
the publisher from any and all claims, action, or 
expense arising from advertising placed in Nuts & 
Volts. Please send all subscription orders, 
correspondence, UPS, overnight mail, and artwork 
to: 430 Princeland Court, Corona, CA 92879. 

JUNE 2004 




Ivex Complete Electronic CAD 
for Windows sets the stage for 
your next big idea! 


All the tools you need together at a special 
b undle savings! http://www.ivex.com/basic650 





Ours 

Theirs 

Schematics 

y 

y 

PCB Layout + AutoRouting 

y 

y 

Web-based Manufacturing 

y 


Order Online: Download and 
start using it TODAY! 

Starts under 
$500 

Up to 
$4,000 

(or more!) 



INTERNATIONAL 


Ivex Design International, Inc. salesgivex.com 
P.O. Box 7156 Tel: 503-53I-3555 

Beaverton, OR 97007 USA advj 5 




Nufs&Vous 


by L. Paul Verhage 


Near Space 


Approaching the Final Frontier 

Near Space 

Choosing the Best Data Loggers forYour Flight 


Data Loggers 

There are several data loggers 
that are capable of fitting inside a 
lunch bag. By carrying one of these 
on the mission, you can collect 
additional science and engineering 
data. Since the data loggers collect 
data at a fixed rate (you program 
this rate into the data logger), you 
can relate the recorded data to the 
altitude of the near spacecraft. 

Here are two commercially 
available data loggers to try: the 
HOBO and the Thermochron. I have 
used the Thermochron on several 
flights and purchased a HOBO for 
evaluation. I like my experiences 
with the Thermochron and am 
impressed with my HOBO and plan 
to use it on my next flight. 

HOBO 

Manufactured by Onset, the 
HOBO is an entire family of data 
loggers. The ones I describe here are 
used with the University of Colorado 
(Boulder, CO) BalloonSat program 
and are a little larger than a box of 



10 


matches. I weighed mine and it 
was only 0.9 ounces. I imagine my 
sensor would weigh more. 

The least expensive HOBO is the 
H08-001-02, which is about $59.00. 
This is a single channel HOBO that 
records just the temperature. It is not 
much larger than a box of matches, 
so you can tuck it anywhere inside 
the near space (NS) craft. 

After recovering the mission, 
you download the temperature 
records from the HOBO and copy 
them into your spreadsheet into a 
new column. Align the temperature 
data with the MET data as closely as 
you can. This means that you need 
to program the HOBO using the time 
according to a GPS receiver. 

Now you can create a chart of 
air temperature as a function of 
altitude. Because the air temperature 
in NS drops below the lower range of 
the HOBO (-4° F versus -60° F), it is 
best used to record temperatures 
inside the NS craft. However, you can 
still determine the altitude of the 
troposphere, because the interior 
temperature of the NS craft tracks 
the outside air temperature. 

Another HOBO data logger is 
the H08-003-02 (about $85.00). This 
one records the air temperature and 
relative humidity. It makes more 
sense to record the relative humidity 
of the air outside of the NS craft than 
inside, so place the HOBO outside 
the NS craft and you’ll have to live 
with the bottoming out of the air 
temperature data. 

If you feel comfortable building 
your own sensors, then consider 
purchasing the H08-006-04, which 
costs about $95.00. This is a four 


external channel data logger. With it, 
you can record either current or 
voltage from four separate sensors. 
For example, CCJ Boulder, CO adds 
solar cells to their BalloonSats. 
These do not provide power for the 
BalloonSat, instead, the HOBO 
records the current generated by the 
solar panel during the mission. 

As the light intensity increases in 
NS, the solar cells produce more 
current. The voltage and current 
limits of the HOBO are 2.5 volts and 
20 mA. You can use sensors that 
create more than 20 mA or 2.5 V if 
you use a current or voltage divider 
in your sensor design. 

HOBOs are programmed with 
the Box Car program (P/N BC3.7-ON, 
$14.00), which is purchased 
separately from the HOBO. I ran a 
test on my HOBO for this article. 
Here’s what I discovered programming 
it. After installing the program, it 
created an icon in Onset 
Applications. A HOBO is connected 
to the comm port of a PC through a 
1/8” jack. Your copy of Boxcar 
comes with this adapter cable. 

Start the application and begin 
programming your HOBO by 
clicking LOGGER, then LAUNCH. 
First, look at the Battery Level gas 
gauge on the right side of the 
window. Don’t launch a HOBO if the 
battery is about to die. 

Give the deployment a name 
in the DESCRIPTION window. I 
recommend using the name of the 
flight. Select an interval. This is the 
time between measurements. 

Measurements could be taken as 
often as every 1 /2 second to as long 
as every nine hours (there is an 
JUNE 2004 




Near Space 


option to create your own interval). 

Each measurement of the HOBO 
requires one byte of memory. There is 
enough memory in the HOBO to 
record for hours or even days (this is 
called the duration). Here’s a listing of 
selected intervals and durations. 

1 sec 2 hr, 15 min 

2 sec 4 hr, 30 min 

10 sec 22 hr 

15 sec 1 day, 9 hr 

30 sec 2 days, 19 hr 

60 sec 5 days, 1 5 hr 

You can easily record data every 
two seconds for a NS mission, 
without running out of memory. 
However, if you do so, you’ll have a lot 
of data to import to your spreadsheet. 
For those records that don’t align with 
Tiny Trak posits, you’ll have to 
interpolate the altitude of the meas- 
urement. This can get tedious if most 
of your data requires it. One option is 
to record measurements frequently, 
but to only copy measurements that 
align with the time stamps of the Tiny 
Trak. (For more on processing Tiny 
Trak posits, see “Near Space” in the 
May 2004 issue of Nuts & Volts.) 

Select Advanced Options and 
make sure the wrap-around option is 
not clicked. If it turns out that your 
NS craft can’t be recovered for a day 
or more, you do not want your flight 
data overwritten with measurements 
taken on the ground. Doing so just 
wastes the time, money, and effort 
you put into the mission. 

It’s best if you program the 
HOBO the night before launch. You 
can instruct the HOBO to delay 
recording measurements until a 
specified time. To do so, click on 
Delayed Start and then enter the date 
and time you want the HOBO to 
begin recording measurements. Be 
sure your PC clock is set to GPS time, 
as I believe the HOBO gets the 
current time from the PC it is being 
programmed on. This also lets you 
correlate HOBO records with Tiny 
Trak time stamps. The date field has 
the format of month/day/year. 

Finally, you can select to Enable 
JUNE 2004 


or Disable channels. Disabling used 
channels creates less data for you to 
import and increases the duration the 
HOBO can record data. When you 
are finished, click on the Start button. 

After the mission, connect the 
HOBO to your PC and offload its 
data. To do this, click Logger, then 
Readout. Data from the HOBO will be 
offloaded. The results are stored as a 
file on your PC. Give the file a 
meaningful name so you can find it 
again later (again, I’d recommend 
naming it after the mission). 

Boxcar can only display one 
channel of data at a time. To change 
channels, click View, Display 
Options, then Channel. Next, select 
the channel you want to look at. The 
results are displayed in a graph. If 
you’re happy with the data, then export 
it to a test file or Excel spreadsheet. 
Click on File, then Export. From 
there, select either Microsoft Excel, 
Lotus 123, or Custom. By selecting 
Custom, you can export the data to a 
text file for editing before moving it to 
a spreadsheet. 

Under Custom, I recommend the 
following settings. Under the Time/ 
Settings, make the Date Format read 
“no date,” as the mission occurred on 
a single day. The GPS does not 


indicate fractions of a second; its time 
is recorded in whole seconds. 
Therefore, it is only necessary to 
make the Time Format, Hr:Min:Sec. 

Under Data Settings, select a 
Data Separator of Comma and select 
the units (channels) that were used 
on the mission. Now click the Export 
button. The resulting file contains 
data looking like this: 

Time, Voltage (V) (*1), Voltage (V) 
(*2), Voltage (V) (*3), Voltage (V) 
(*4) 

19:25:00,0.874,0.659,0.366,0.288 

19:25:02,0.132,0.122,0.103,0.103 

19:25:04,0.073,0.073,0.073,0.083 

19:25:06,0.063,0.073,0.073,0.073 

19:25:08,0.063,0.073,0.073,0.073 

19:25:10,0.142,0.142,0.063,0.073 

Open a text editor and copy the 
data that you want to keep into a 
spreadsheet. Once that data is 
formatted correctly, you can Copy 
and Paste the data from the new 
spreadsheet into the Tiny Trak posit 
spreadsheet. 

After talking with Onset, I found 
out that they also make a pressure 
data logger that is good up to an 
altitude of 32,000 meters. This HOBO 



Electronics and Electrical V8.2 


www.eptsoft.com 


Mathematics and Computing V8.2 - $9 
Mechanics and Electrical V8.2 - $9 
Electronics, Mechanics and Computing V8.2 - $24 




Nuts & Volts 


Near Space 



TheThermochron. Photo courtesy of 
Maxim IC/Dallas Semiconductor. 


is model number HPA and costs 
$249.00. You’ll find Onset at 
www.onsetcomp.com Their 
website contains several other 
sensors suitable for the HOBO. 

Thermochron 

Another data logger is the 
Thermochron. Maxim IC purchased 
Dallas Semiconductor and currently 
sells their line of one wire devices. 
The Thermochron is a sealed, 
stainless steel device containing a 
clock, temperature sensor, memory, 
and battery. It’s tiny — only about the 
size of five stacked dimes. 

A Thermochron is programmed 
just like a HOBO. After installing the 
software, select iButton Viewer under 
the iButton-TMEX group. Ignore the 


The BS2pe. 

Photo courtesy of Parallax, Inc. 



12 


Format Window and go straight to 
the Thermochron Viewer. Select the 
Wizard Tab. Click the NEXT button 
and set the time in the Thermochron. 
Select to set the Thermochron to the 
PC’s clock (be sure to set your PC to 
the time on a GPS receiver). The 
funny thing is that I found the 
Thermochron’s time to be more 
accurate than my laptop’s clock. 

Click NEXT and skip setting an 
alarm. Click NEXT and set the 
Mission Start Delay. With the 
Thermochron, you must do a little 
math, as you set the delay in days, 
hours, and minutes from the time 
that you are doing the programming. 
You don’t set the time to begin the 
mission. Do your math carefully and 
be sure to begin recording data 
before the expected launch time. 

Click NEXT and set the sample 
rate. The shortest sample rate is 
once a minute. I find this is adequate 
for my missions. Click NEXT and do 
not set Temperature Alarms. Click 
NEXT and do not Enable Roll-Over. 
Click NEXT once more and then 
FINISH. You can now remove the 
Thermochron from its reader and 
load it onboard the NS craft. 

After recovery, use the same 
software to download data from the 
Thermochron by clicking on the 
Mission Results tab. Here, click on 
the Read Data Button. After the 
data is downloaded, you can either 
generate a graph or export the 
results. Click either the Quick Graph 
button or the Export Result button. 

After clicking the Export Results 
button, you’ll be asked to give the 
resulting file a name. Again, use a 
meaningful name so you can find the 
file later. Be sure you stop the 
mission after you download the 
Thermochron’s data, as there’s no 
need to use the internal battery to 
collect more data when you don’t 
need it. That’s it. The results are 
similar to those of the HOBO. 

Output from the Thermochron 
contains data not needed by the 
spreadsheet. Delete this information 
in a text editor. The resulting data 
looks like this: 


Log Data 

Format: [Time/Date , Temperature] 
(Fahrenheit) 

08/03/2003 05:54 , 73.4”F 
08/03/2003 05:55 , 73.4”F 
08/03/2003 05:56 , 73.4°F 
08/03/2003 05:57 , 73.4”F 
08/03/2003 05:58 , 73.4°F 
08/03/2003 05:59 , 73.4”F 

In WordPad, you’ll want to delete 
all instances of the date. Then 
change the colon in the time file to a 
comma. You can also remove the 
extra space around the comma 
between the time and temperature by 
typing “ , “ in the Find What field and 
typing in the Replace With field. 

Be sure to purchase a fob to hold 
the Thermochron, as it can easily get 
lost inside an NS craft. Also, since it’s 
made from metal, place the 
Thermochron where it cannot short 
out the battery inside the module. It’s 
a very bad sign when you see the NS 
craft climb out trailing a line of smoke. 

Thermochrons are the ideal data 
logger if you want to compare the 
temperatures between objects of 
different colors or constructions. Each 
Thermochron has a unique ID printed 
on the case and this ID is displayed 
along with the measurements of 
Thermochron. Be sure to record which 
Thermochron ID went into which 
object being tested. You can purchase 
a Thermochron Starter Kit from 
Dallas-Maxim. The starter kit comes 
with the programming cable, a 
Thermochron, and memory. The 
programming software is free. The 
part number is DS1921K and costs 
$30.00. You will find information on 
the Thermochron starter kit at 
the Dallas/Maxim website: www. 
maxim-ic.com 

Hitchhiker 

More advanced users will want 
to design their own data loggers. The 
benefit here is that you can 
customize your data logger to fit any 
sensor you can design. After a visit 
to the Parallax office in December 
2003, I developed an idea based 
JUNE 2004 





Near Space 


upon input from Parallax’s Ken Gracey. I’ll develop this 
idea further and I will call them Hitchhikers. 

The BASIC Stamp 2pe contains an additional 16 kb of 
EEPROM over the BS2p. It contains the same amount of 
scratch pad RAM as the BS2p, which allows you to record an 
entire GPS sentence for parsing at a later time. The BS2pe 
was designed with data loggers in mind. By purchasing a 
BS2pe and Board of Education (BoE), you can whip up a 
data logger that can be reconfigured mechanically and 
logically for each mission. The simplest Hitchhiker is 
programmed to record data at a fixed time interval. It 
requires a Push To Initiate button to tell it when to start 
recording. It is pushed just before the NS craft is released. 
This way, the time that data collection starts is known and 
no memory is wasted collecting data before launch. 

The more advanced Hitchhiker shares the GPS output 
of the NS craft. Now, the altitude of the mission is recorded 
along with the results of experiments. Parallax sells a wide 
variety of App Mods for their BoE. Best of all, the code 
needed to integrate the App Mod into the BoE is available 
on their website. This dramatically reduces the time 
required to get a Hitchhiker ready for an NS mission. 

One example of an appropriate App Mod is the 
SHT1X, a combined temperature and humidity sensor. 
The SHT1X can be mounted directly to the BoE or you can 
solder a cable to its pins before plugging it into the BoE. 
Using a cable allows the BoE to remain well inside the NS 
craft while letting the SHT1X sample the air outside. 

More than App Mods are available. The texts for the BoE 
give instructions for creating several other sensors. I created 
a PCB for some of my past missions that is a light sensor 
based on LEDs. This lets one of my missions measure how 
sky brightness changed in blue and violet/near UV as the 
altitude increased. If you teach the Parallax microcontroller 
curriculum in a classroom, perhaps you can find a local 


amateur NS group that can fly a class project into NS. It’s 
guaranteed to be easier and cheaper than getting a sounding 
rocket flight. This concept is new, so I have yet to fully develop 
it. Keep reading Nuts & Volts for developments. NV 



& Yost Eng ine ering Inc. 


Want { fir } Control? H| 

Then try the YEI ServoCenter 3.1 Controller! HPii 

ServoCenter allows independent & simultaneous serial control of the seek speed & position of 16 hobby servos per board. 



* 



JUNE 2004 


$48 95 1 features: 

Module*Only | 


$69.95 

Full Package I 


Package Includes: 


♦ 1 6 Servos per board & up to 1 6 linked boards for simultaneous control of up to 256 servos! 

♦ Scaled positioning mode for programmable maximum/minimum/startup points. 

♦ Selectable baud rate with a compact yet robust serial protocol. 

♦ On-board regulator provides 6.0V or 4.8V servo power with over-current & thermal protection. 

♦ Code examples for: GCC/LINUX, QBASIC, Visual Basic 6.0, Visual C++ 6.0, Turbo C. 

♦ OCX custom control for instant VB/VC++ programming. 

Power adapter, serial cable, sample code/applications CD, and user's manual / programming guide. 


Learn more at: www.YostEngineering.com/ServoCenter 







1 - 800 - 446-2295 


Mini-Kits... 

The Building Blocks! 


(Professional FM Stereo Padio Station 


✓ Synthesized 

✓ Built-in mixer - 2 line inputs, 1 mic input 

✓ Line level monitor output 
ui "h power version available for export u 

I new design of our very popular FM100! Designed new from' 

the ground up, including SMT technology for the best performance 
ever! Frequency synthesized PLL assures drift-free operation with 
simple front panel frequency selection. Built-in audio mixer features 


1 Watt, Export Version. Wired & Tested 


Professional 40 Watt Power Amplifier 



✓ Frequency range 87.5 

✓ Variable 1 to 40 watt 


watts output that has variable drive capabilities. With 


cycle to keep your station 

_ PA100 40 Watt FM Power Amplifier, Assembled & Tested 


FM25B features a PIC microprocessor for easy frequency programming with-i 
out the need for look-up tables or complicated formulas! The transmit fre- 1 
quency is easily set using DIP switches; no need for tuning coils or "tweak- 










Where The fun Always Starts! 


Phone Patch Mixer 


. telephone calls over-the-air! 

✓ Stereo line/mic/phone line mixer! 

✓ Automatic gain, noise gating & compression! 

perfect match to any of our AM or FM 



add a microphone (after all, you 

Jockey of your station!) or if you want to put incoming 
phone calls on-the-air and properly mix them together, it 
becomes difficult! Not anymore with the PPM3. All three 
can be easily mixed tc 
our transmitter kits! 

er's^ine level input and you're all set! Separate independent automatic 
ing and automatic variable gain and compression circuits are used for both the 
telephone line audio and microphone inputs to assure a great sounding line out- 
putf The stereo line level mixer features mono injection of phone line and micro- 
phone audio for equal balance. Powered by 9-1 5VDC. Now when those people 
call complaining about YOU, put THEM on-the-air! 

PPM3C Phone Line Interface/Mixer Kit With Case $69.95 

AC125 110VAC Power Adapter $9.95 

PPM3WT Factory Assembled & Tested PPM3C With Case & PS $99.95 



✓ Chirps like a real cricket! " ' 

✓ Senses temp & changes chirp accordingly! 

✓ You can determine actual temp by chirps! 

✓ Runs on 9VDC 

Sounds just like those little black critters that 
seem to come from nowhere and annoy you 
with their chirp-chirp! But like the little critters, 
we made it sensitive to temperature so when it gets warmer, it chirps faster! 
That's right, you can even figure out the temperature by the number of chirps it 
generates! Just count the number of chirps over a 15 second interval, add 40, 
and you have the temperature in degrees Fahrenheit! 

Not as fancy as a digital thermometer, but nc 
tie black predecessor, the ECS1 operates from ar 

, u variable chirp th. 
around you! But just watch their faces when 


iu tell them the temperature 


Runs on 9-12VDC or a standard 9V battery (not included). Includes everything 
shown, including the speaker and battery clip, to make your cricket project a 
breeze. But don’t step on it when it starts chirping...voids the warranty! 

ECS I Electronic Cricket Sensor Kit $24.9 


✓ Negative ions with a blast of fresh air! 

✓ Generates 7.5kV DC negative at 400uA 

✓ Steady state DC voltage, not pulsed! 

This nifty kit includes a pre-made high voltage ion 
generator potted for your protection, and probably* 
the best one available for the price. It also m 

includes a neat experiment called an "ion wind 
generator". This generator works great for pollu- ^ 
tion removal in small areas (Imagine after 

Grandpa gets done in the bathroom!), and m 

the air through the filter simply by the force of ion repul- 
sion! Learn now modern spacecraft use ions to accelerate through space. 
Includes ion power supply, 7 ion wind tubes, and mounting hardware for the io 
wind generator. Runs on 12 VDC. 


it Supply 




Electrocardiogram Heart Monitor 


✓ Visible & audible display of your hi 

✓ Re-usable sensors included! 


Enjoy learning about 
the inner workings of 



ering the stage-by-stage electronic 
circuit theory used in the kit to moni- 
tor it. The three probe wire pick-ups I 
allow for easy application and experimentation without the cumbersome harness 
normally associated with ECG monitors. Operates on a standard 9VDC battery. 
Includes matching case for a great finished look. The ECG1 has become one of 


ECG1C Electrocardiogram Heart Monitor Kit With Case 

ECG 1 WT Factory Assembled & Tested ECG 1 

ECGP10 Replacement Reusable Probe Patches, 10 Pack 


$44.95 

$89.95 

$7.95 



In 1986 we introduced the COM3 
Communications Sen/ice Monitor which broke 
the $2K price barrier for performance features in 
the $10K units! The legacy continues at Ramsey with the 
brand new COM3010! 


of 100kHz all the way up to 1 .0GHz at 0.1 ppm accuracy, the COM3010 

boasts a full compliment of built-in features. This includes a power meter with a 
100W dummy load, SINAD meter, frequency counter, sweep generator, calibrated 
RSSI meter, RS232 control and Li-Ion batteiy operation. Foolproof design auto- 
matically switches any RF power mistakenly keyed into the signal generator input 
directly to the dummy load! No more friea front ends! 

The COM3010 receives and displays both AM and FM modulation. The signal gen- 
erator also provide both AM/FM modulation with internal and external sources, 
and generates CTS and DPL tone squelch tones. The built-in frequency counters 
measure and display RF from 100kHz to 1GHz and audio from 60Hz to 3KHz. The 
entire service monitor weighs only 14 lbs for easy travel. Includes one Li-Ion bat- 
tery pack to provide 1 hour of operation. Two additional battery packs may be 
added to extend life to 3 hours. Visit www.ramseytest.com for details. 

COM3010 Communications Service Montior, 100kHz-l GHz $4795.00 

BP3010 Additional Li-Ion Battery Pack (Max 3 Packs) $64.95 

rrxmn Matching Black Padded Cordura Carrying Case $129.95 


The BuUshooter-ll 
Digital Voice Recorder 


✓ Variable output levels for any equipment! 

✓ Perfect for hold messages, broadcast 



rate stored messages. The message number is displayed on the 7 seg- 
ment LED front panel display! Recording/playing/stopping is similar to a standard 
recorder. You can start, stop/pause your message during both record and play- 
back! Now you can have separate and distinctive messages to fit various appfica- 
tions...or even different sponsors! 

The BS2 has a built-in, highly sensitive electret condenser microphone for record- 
ing your voice messages. However, you can also plug in an external microphone 
and even an externalline level input for that professional studio sounding record- 
ing. External inputs also feature variable level controls to optimize your recording! 

Playback-wise, the BS2 features adjustable line level outputs (two mono outputs 
for stereo inputs) to properly feed any application! This is perfect for telephone 
system announcements on hold (MOH source), radio broadcasters, transmitters, 
and audio/visual displays. You can also directly drive a speaker with the built-in 
amplified speaker output and monitor the levels with the built-in headphone jack. 
Whatever your application is, the new BS2 has you covered! Runs on 12-15VDC. 
BS2C Bullshooter-ll Digital Voice Recorder Kit With Case 
AC125 1 10VAC Power Supply 

BS2WT Factory Assembled & Tested BS2 With Case & PS 


MORE than just friendly on-line ordering! 

Clearance Specials, Ramsey Museum, User Forums, Dealer Information, FAQ’s, FCC 
Info, Kit Building Guides, Downloads, Live Weather, Live Webcams, and much more! 

www.rqm sgykits.com 

800 - 446-2295 

♦ Build It! 

590 Fishers Station Drive ♦ Leam It! 

(8w) 446-2295 4 b £5** * Achieve IU 

(585) 924-4560 ♦ Enjoy It! 


Where 
Electronics 
Is Always 
FUN! 







siiOAtsiON 


Just For Starters 


by Mark Batch 


Basics For Beginners 

Just For Starters 

Starting a New Design — Part I : 
Architecture and Implementation 


Y ou came up with the 
solution to a problem and 
decided to build it yourself. 
How do you get started? Starting a 
new design on a blank sheet of 
paper can be difficult. The basic 
challenge is to analyze the features 
that you want to implement and 
determine what type of circuit is 
called for to perform each task. This is 
the essence of system architecture: 
translating high level requirements 
into a system block diagram. 

Developing a system architecture 
requires a broad knowledge base 
so that you can trade off the 
benefits and drawbacks of different 
implementation strategies. Such 
knowledge comes from experience 
and self education. (Like fine wine, 
we hope to get better with time!) 
Some functions are best solved by 


analog or digital circuitry or by a 
combination of the two. You can 
develop skills to break a problem 
down into its component parts and 
then conceive of implementations 
for those small sections. 

In this first installment of a two 
part series, we’ll walk through a 
small project scenario to see how to 
go from concept through design. 
The first step is translating project 
requirements into an architectural 
organization. Implementations using 
both analog and digital approaches 
are then presented and compared. 
Next month’s article will discuss how 
designs are implemented with state 
machines and microcontrollers. 

Identifying the 
Requirements 

To get started on a 
project idea, let’s say that 
you want to make an LED 
blink. What does blink 
mean? Do you just want a 
simple on/off at a fixed 
frequency and duty cycle? 
Do you want a repeating 
pattern of some sort? Do 
you want the blink rate or 
duty cycle to change based 
on some inputs (e.g., 
switches)? These types of 
questions figure prominently 
into the architecture of an 
LED blinking circuit. We 
can begin by examining 
the simplest case: a fixed 
frequency and duty cycle 
blinking LED. Let’s arbitrarily 
choose a 2 Hz blink rate 


(twice per second) and a 25% duty 
cycle. The blinking period is the 
inverse of the frequency: T = 1/F = 500 
milliseconds (ms). A 25% duty-cycle 
means that the LED is on for one 
quarter of each period: T ON = 125 ms 
and T 0 ff = 375 ms. It is worth noting 
that the required accuracy is not high. 
If the LED is on for 119 ms instead of 
125 ms, no great harm will occur. In 
situations where high accuracy is 
required, this is a critical requirement 
that drives system architecture. 

Architectural 

Definition 

Upon completing the require- 
ments phase, the question becomes 
what is the best way to generate a 
control signal that repeats with the 
pattern, “on for 125 ms and off for 
375 ms.” The first architectural need 
that surfaces is a time-base. Some 
sort of time keeping mechanism is 
necessary to provide consistent 
operation. Closely related to the 
time-base is a mechanism to convert 
the time-base into our required “on” 
and “off” intervals. 

Figure 1 shows a simple block 
diagram for our LED blinker. 
Realizing that an architectural diagram 
may not translate directly into a 
circuit with a discrete component for 
every box is important. Rather, 
specific implementations may merge 
or further subdivide the architecture’s 
logical building blocks. A circuit 
component may perform multiple 
features or it may perform only part of 
a feature. This variable mapping will 
become apparent as we discuss 
JUNE 2004 



16 




Just For Starters 


various solutions to the problem. 

An Analog 
Approach 

An LM555 timer integrated 
circuit (IC) can generate a repetitive 
on/off signal, as shown in Figure 2. 

(If you want to read more about the 
LM555’s operation, visit appropriate 
manufacturers’ websites, such as 
www.fairchildsemi.com or 
www.national.com) The LM555 
implements all three architectural 
features: time-base, interval generation, and LED driving. 
Better yet, this analog circuit can be built for less than 
$1.00 and requires just the LED, three resistors, two 
capacitors, and the LM555 itself. R A and R B establish the 
blink rate and duty-cycle: 

Blink rate (Hz) = 1.44 

(R a + 2R b ) C 

T 0 n (LM555 output low) = 0.693 R B C 


clock for T 0 n and three for Tqff- 
The reality is that a digital clock 
oscillator will run much faster than 
8 Hz, but the idea is to pick the 
lowest practical clock frequency. 

Counter 

Implementations 

Most digital clock oscillators 
are found in the MHz range 
because typical microprocessors 
and logic circuits operate at high 
speeds. However, 32.768 kHz 
oscillators can be found in many electronics catalogs. The 
two general solutions to implementing the counter with a 
32.768 kHz clock are illustrated in Figure 3. One is to 
construct a single counter that can count the full blinking 
period — 500 ms, in our case. With 32,768 cycles per 
second, the counter must count 16,384 cycles to cover 500 
ms. That’s a 14-bit binary counter that counts from zero to 
16,383 and then rolls back to zero. 

The alternative is to construct two smaller counters: a 
prescaler and an event counter. The prescaler generates 
the ideal 8 Hz frequency mentioned previously. This allows 



T off (LM555 output high) = 0.693 (R A + R B )C 

Duty cycle (%) = 100% x ~^ ON 

Ton + t off 

The LM555 relies on RC time constants. Keep in mind 
that a capacitor’s finite leakage current can cause trouble 
in very long time, constant circuits. As the calculated 
charge/discharge currents get smaller, leakage current 
introduces more error than with the more rapid charging 
and discharging of shorter time constants. 

Digital Logic 

Despite having come up with a simple and cheap 
analog circuit, let’s investigate a digital solution. Digital — 
in this context — refers to synchronous digital logic: clocks, 
flip-flops, and logic gates. More information on synchronous 
logic, clocks, and Boolean logic can be found in my book, 
Complete Digital Design. Synchronous logic inherently 
requires a time-base, or clock, to function, which is one of 
the basic elements in our architectural diagram (Figure 1). 
The clock determines the unit of time that the logic operates 
on. Next, a counter circuit counts time units, or clock 
pulses, and determines when to turn the LED on and off. 

One always wants to minimize circuit complexity, 
which translates to smaller counters in this example. Since 
the counter needs to count out 125 and 375 ms time 
intervals, the counter will be smaller if the clock runs at a 
lower frequency. To take an extreme case: if the clock period 
is 125 ms (8 Hz), the counter would need to count just one 
JUNE 2004 





Nuts &Volts 


Just For Starters 


Figure 4. Counter Decoder Logic 


bits 13,12 of 14-bit counter 
bits 1,0 of prescaled event counter 



a smaller event counter to blink the 
LED on and off. In our case, the 
prescaler is a 12-bit counter because 
2 12 = 4,096 and 32,768/4,096 kHz is 8 
Hz. A two-bit event counter counts a 
single cycle for T ON , three for T Q ff. 
and then restarts at zero. 

You may wonder why a prescaler 



is useful, since there are 
still 14 counter bits in 
total. Prescalers can 
simplify a design by 
breaking a large counter 
into smaller counters. The 
total amount of counter 
logic with a prescaler is 
generally less than with a 
single large counter. In 
our example, the point may be moot 
depending on your components and 
implementation technology. More 
general problems, however, can be 
simplified with a prescaler. 

Blinker Logic 

Now that the counter problem 
has been solved, we need to convert 
the counter output into a blinking 
LED. With or without the prescaler, 
two counter bits are decoded, as 
shown in Figure 4. With the prescaler, 
the two-bit event counter feeds an OR 
gate. Without the prescaler, the two 
most significant bits of the counter feed 
the OR gate. In both implementations, 
these two bits increment every 125 ms. 
The OR gate drives a zero output when 
both input bits are zero and otherwise 
drives a one output. The LED is 
connected through a current-limiting 
resistor to turn on when the OR gate 
drives a zero output. (This is because 


commonly used TTL devices can sink 
more current during a zero output than 
they can source during a one output.) 

Analog Versus 
Digital 

The digital circuit is more complex 
than the analog circuit, but there are 
no time constant accuracy problems 
with longer blinking periods. Longer 
periods require larger counters, however, 
which add their own complexity. You 
don’t get something for nothing! 

Aside from the basic issue of 
longer or shorter blinking periods, 
which circuit is best when more special 
effects are called for? How would a 
multi phase pattern be implemented, 
such as, “quick blink, pause, slow 
blink, pause, repeat?” The LM555 
circuit can be modified to dynamically 
alter its time constants, but the 
additions can quickly get complicated. 

The digital circuit, while initially 
more complex, is more easily 
augmented because arbitrary counter 
decode logic can be added. Any of 
the counter bits may be used to form 
complex blinking patterns. Next 
month’s article will address more 
complex counter decoding and will 
take digital design a step further into 
the realm of microcontrollers, where 
flexibility becomes even greater. NV 


Order online at: 
www.melabs.com 


Serial Programmer 
for PICmicro 


Development Tools for PICmicro MCUs 

miaoQLngineerimf ^abs, ®nc. 


Colorado Springs, CO 80960 



$ 119.95 

Includes: 

Programmer _n>~- . 

9-pin Serial Cable U °B Adapter 

AC Power Adapter $39.95 

ZIF Adapter for 8 to 40-pin DIP 
Software for Windows 98/Me/NT/2K/XP 


EPIC Parallel Port 
Programmer 
starting at $59.95 


LAB-X Experimenter Boards 

r Pre-Assembled Board 
E Available for 8, 14, 18, 28, 
and 40-pin PIC MCUs 
2-line, 20-char LCD Module 
9-pin Serial Port 
Sample Programs 
Full Schematic Diagram 
Pricing from $69.95 to $349.95 



PICProto Prototyping Boards 

■ Double-Sided with Plate-Thru Holes 
Circuitry for Power Supply and Clock 
Large Prototype Area 
Boards Available for most PIC MCUs 
Documentation and Schematic 
Pricing from $8.95 to $19.95 


BASIC Compilers for PIC MCUs 

a Easy-To-Use BASIC Commands 
Windows 9x/Me/2K/XP Interface 
PicBasic Compiler $99.95 
BASIC Stamp 1 Compatible 
Supports most 14-bit Core PICs 
Built-In Serial Comm Commands 
PicBasic Pro Compiler $249.95 
Supports all PICmicro MCUs 
Direct Access to Internal Registers 
Supports In-Line Assembly Language 
Interrupts in PicBasic and Assembly 
Built-In USB, I2C, RS-232 and More 
Source Level Debugging 


See our full range of products, including 
Books, Accessories, and Components at: 

www.melabs. com 






‘Saving on eBay put our company into a whole new orbit. 



www.ebaybusiness.com 

Circle #36 on the Reader Service Card. 


_L gkj 

efipr 


At hrst, I wasn't sure I would hnd the sophisticated equipment we 
needed on eBay. Well, not only did I find it, I found it for a lot less. 
We've gotten more than $750,000 worth of test gear on eBay — signal 
generators, oscilloscopes, analyzers, you name it — for less than 
$100,000. That savings goes right back to our bottom line.” 




Nufs& Volts 


Electro- Net 


Go to www.nutsvolts.com — click Electro-Net 


Test & measurement equipment 
on eBay? Of course! 

www.ebavbusiness.com 


eftpr 

Business 


For the PIC MCU 
262 - 797 - 04-55 
www.ccsinfo.com/env 


EarthL.lv. 


COM 


See the World's Largest Collection 
of LCDs and LCD Products 


Your BASIC Stamp Headquarters 


B*R4Li/4X 7t 

www.parallax.com 


USB 


Add USB to your next project— n 

it’s easier than you might think! V Design 

• USB-FIFO • USB-UART • USB/Microcontroller boards 

Absolutely NO driver software development required! 

www.dlpdesiqn.com Design services available 



Low Cost 
Digital 
Power 
Control 
Products 


F E_ 

L 3 



www.flex-tek.com 


www.gatewayelectronics.com 

(Electronically Speaking, Gateway’s Got It!) 

MAIL ORDERS CALL TOLL-FREE- 1 -800-669-58 10 


PIC Micro Development Boari 

. PIC 16F877& PIC 16F627 

• Solderless Bread Board & Prototype Board 

• 4-Channel Relay (For AC or DC Switching) ___ _ 

• 12 Button Keypad & 16x2 LCD with Driver. 

. Thermistor, Photo-Resistor & Hall Effect Sensor. * * CQ nn 
. RS232 for Serial Communication , „ , 4 >IOS.UU 

. Bootloader Enabled! www.schellelectronics.com 



HW.netmedia.com 






[HlIXTOOWlXf 

Protek, Extech, 

& Probe Master 
hilltronix.com 


LWr'~J Robotics, Electronics, 
\\\ [V| & Science Supplies 

IMAGES SI INC. 

www.imagesco.com 



www.onepasmc.com 


Go to www.nutsvolts.com — click Electro-Net 








Guest Hosted by L Paul Verhage 


Personal Robotics 


Understanding, Designing, and Constructing Robots and Robotic Systems 

Transistors as 
Digital Switches 

An Example Using Miniature R/C Racing 
Cars for Data Transmission 


O ften, we need our robot to 
make or break a circuit. This 
lets our robot operate a 
sensor, emit a warning tone, or even 
fire photon torpedoes. While we 
humans are really great at pushing 
buttons, robots have a problem 
because they tend to lack fingers and 
opposable thumbs. So just how do 
robots turn on and off circuits? 

If the circuit requires minimal 
power (say five volts at 10 milliamps), 
then the robot’s microcontroller can 
often power the circuit itself. In the 
case where power requirements are 
just too high for the robot’s brain, we 
usually rely on things like relays, 
SCRs, and transistor switches. 

These devices are like levers. It 
requires very little power to switch on 
a relay, SCR, or transistor, but they 
can source or sink large amounts of 
power. This article explains how you 
can use transistors to operate a radio 
transmitter and receiver. You’re going 
to hack the guts of an R/C car and 
turn it into a wireless link for robots. 

Earlier this year, I purchased a 
single channel R/C airplane and 
experimented with modifying its radio 
for a robot project. The hack went 
well and, eventually, I put the radio to 
work at 85,000 feet (see my article in 
this month’s SERVO Magazine). 
However, I saw one problem with the 
radio; it’s a single channel radio (with 
a very slow baud rate). This is fine for 
projects were robots only transmit 
small packets, like a nibble of data. 
JUNE 2004 


To add more capability to my 
cheap wireless hack, I decided to use 
a radio with more channels. I found 
an inexpensive solution in an 
advertisement from Cyberguys 
(www.cvberguys.com) . They were 
selling miniature R/C racing cars that 
were similar to the Zip Zaps sold at 
RadioShack (Figure 1). 

Removing the 
Transmitter and 
Receiver 

The cars are about 2” x 1” x 1”. 
After prying off the body and cover for 
the receiver (be careful that you don’t 
pull off the wire antenna), I found a 
3/4” x 3/4” circuit board containing 
the radio receiver and drive electronics. 
In addition, the car has a pager motor, 
rechargeable 1.2 volt N-cell, and super 
magnet. These leftover parts are ideal 
for BEAM robotics projects. 

Removing the circuit board from 
the car requires that you unsolder 
wires from six pads. You can cut the 
wires, but I recommend unsoldering 
them. The solder pads are small, so 


the work goes quick. Two of the wires 
to unsolder are very fine magnet wire 
and the rest are more substantial. 

The transmitter has a larger PCB 
measuring 2” x 3”. My radio was 
crystalled for 45 MHz, but three other 
frequencies are available. If you forget 
your transmitter’s frequency, you’ll 
find it stamped on its crystal. The 
45 MHz band is legal for all R/C 
applications. Other frequencies are 
also legal for all R/C applications, 
except for the 75 MHz band, which 
cannot be used for aircraft. Be aware 
of this if you plan to hack an R/C 
model for use in an aerobot. 

Now, we’ll remove the transmitter 
from its plastic case. The 
transmitter’s antenna screws into a 
socket in the transmitter’s case and is 
electrically connected to the top of 
the PCB with a thin gray wire. 
Remove the small screw that secures 
the antenna socket to the case. There 
are a couple of screws to remove to 
get the transmitter PCB free of the 
case. Finally, cut the wires to free the 
PCB from the battery holder. 

Now that the transmitter and 




Nuts&Volts 


Personal Robotics 


receiver have been removed, it’s time to 
make their microcontroller interface 
boards. You will need the following 
parts to complete this project. The 
perfboard — RadioShack P/N 276-170 
— is a general-purpose board, while 
the 276-168 replicates a breadboard. 

To hack the transmitter and 
receiver, you’ll need to solder wires 
to the transmitter and receiver 
printed circuit boards. Then you’ll 
assemble the interface boards on 
perfboard. After that, you’ll solder 
the wires from the transmitter 
and receiver to the interface boards 
you just assembled. Then, you’ll 
terminate the wires from the interface 
boards so they can connect to your 
robot controller. Finally, you’ll need 
to modify and download the software 
I wrote to operate the radios 
(available on the Nuts & Volts FTP 
library at www.nutsvolts.com) . 
The entire process takes an afternoon, 
so it’s a good way to get away from 
the television. 


e 2. Three channel receiver schematic. 



Modifying the 
Receiver 

Figure 2 shows the schematic 
for what you’re about to do to the 
receiver, while the physical layout I 
used is illustrated in Figure 3. Feel 
free to modify this as you see fit. 
After making two receiver interface 
boards with perfboard, I designed a 
printed circuit board. A copy of the 
copper foil pattern is also available 
on the Nuts & Volts website. 

Begin modifying the receiver by 
placing a fresh bead of solder on all 
six solder pads of the receiver board. 
Note that each solder pad is labeled. 
Nine wires are required to connect 
the receiver PCB to the interface 
board, three wires to the Vcc pad, 
two to the GND pad, and one each to 
the L, R, F, and B pads. 

1 used green for ground and red 
for positive voltage (Vcc). The solder 
pads labeled L and R are connections 
to ground, so I selected a black wire 
for these solder pads. 
The polarity of the two 
remaining solder pads 
depends on the direction 
you drive the R/C car. 
We’re interested in when 
the voltage of the F solder 
pad is positive compared 
to the voltage of the B 
solder pad. I recommend 
using a bright color for the 
F solder pad and black for 
the B solder pad. 

Cut nine stranded, 
#24 AWG wires about 12” 
long and strip about 1/4” 
of insulation from one end 
of the L, R, F, and B wires 
and tin them. Then snip 
the tinned ends to a 
length of about 1/8”. 
Clean and tin the tip of 
your soldering iron. Place 
each wire in contact with 
its solder pad and apply 
heat with a soldering iron 
and they’ll solder together 
without additional solder. 

Strip about 1/2” of 
insulation from one end of 


the Vcc and GND wires. Twist the 
three Vcc wires together and solder 
them. Next, twist the two GND wires 
together and solder them. Trim the 
tinned ends to less than 1/4” long. 
Clean and tin your soldering iron 
again. Place the soldered wires in 
contact with their proper solder pads 
and heat them until they are 
soldered to their solder pads. 

Clse one each of the Vcc and 
GND wires to solder a single cell AA 
or AAA holder to the receiver. Don’t 
forget to slide a length of heat shrink 
tubing over the wires first. To get a 
single AAA battery holder, I cut a 
two-cell holder down the middle. It 
didn’t save any money, but did save 
a little volume. You can now set the 
receiver printed circuit board aside to 
work on its interface board. 

Using the layout in Figure 2, 1 was 
able to make the receiver interface 
board only 1-1/4” by 1-3/4” in size 
using the 276-170 perfboard. Before 
you begin cutting your perfboard or 
soldering your first component, place 
all the components into the perfboard 
and make sure they fit well. 

The thin lines on the perfboard 
in my diagram represent the jumper 
wires and the thicker lines represent 
#24 AWG stranded wire. For the 
jumper wires between traces, use the 
clipped leads of the resistors (waste 
not, want not). 

There are four jumper wires in 
my diagram ending in the letter G. 
These are ground wires and must be 
connected together. I made the 
connections with a copper trace on 
the underside of the perfboard, 
which doesn’t show in my diagram. 
These jumpers connect the ground 
of the receiver circuit to the ground 
of the robot controller. 

When you’re happy with the 
placement of parts, trim the 
perfboard and sand the raw edges 
smooth. You can begin soldering 
components into the perfboard. I 
find that a short strip of masking 
tape is very useful for holding 
components in place when I flip the 
board over. Trim the leads after 
soldering and check for shorted 
JUNE 2004 




Personal Robotics 


traces. Now, you’re ready to connect 
the interface board to the receiver. 

It’s best if each wire in the cable 
connecting the interface board to the 
receiver board has a strain relief (see 
Figure 6). I make a strain relief by 
enlarging a hole in the perfboard until 
an insulated wire can pass through it. 
The wire passes through the enlarged 
hole and then bends over where it is 
soldered to the perfboard. Now, if the 
wire is tugged, friction between the 
wire’s insulation and the hole reduces 
the chances of the wire being pulled 
loose from its soldered connection. 

Cut the seven remaining wires 
from the receiver circuit board to the 
same length and strip some insulation 
from the ends. Pass the wires through 
their strain relief holes, bend, and 
solder them to the perfboard. 

Solder the wire from the F and 
the remaining two wires from the Vcc 
solder pads to the three resistors (Rl, 
R2, and R3). Solder the wires from 
the B, L, and R pads to the emitters of 
the three transistors (the rightmost 
transistor lead in the diagram). The 
last wire from the ground solder pad 
is soldered to the ground jumpers 
(labeled with a G in my diagram). 
Remember, this connection is not 

made to the transistors, it’s 

made to the microcontroller. 

This is all that is needed 
to connect the interface 
board to the receiver. Now 
you can connect the interface 
board to the microcontroller. 

Cut three red, three black, 
and three white wires all to a 
length of six inches and strip 
some insulation from one end 
of each wire. Determine which 
holes you want to use as a 
strain relief and enlarge them 
slightly. Bend the wires back 
and through their strain relief 
holes in the perfboard. Solder 
the red wires to the pull-up 
resistors, the black wires to 
the ground jumpers, and the 
white wires to the transistor 
collectors. 

Terminate the wires in 
any manner appropriate for 
JUNE 2004 


your robot controller. I personally use 
a three-pin male header because of 
the design of the expansion ports in 
my robot controllers. To terminate 
the ends of my wires, I tin the stripped 
ends. Next, I cut a three pin length of 
male header, tin the short leads, and 
slide a short length of thin heat shrink 
over the end of each wire. After 
holding the tinned wire in contact 
with the header pin, 1 apply a soldering 
iron and solder the two together. I 
repeat this to the remaining two pins. 
I finish the header by sliding the heat 
shrink over the soldered connection 
and shrinking it. 

To make the hack more 
durable, mount the perfboard and 
receiver circuit board to a base. 1 
zip tied mine to a sheet of 
correplast (corrugated plastic). 
You’ll find the 1/8” thick Sintra 
(foamed PVC) just as easy to work 
with. I filled the gap between the 
perfboard and correplast with a 
sheet of foamed neoprene, sold at 
craft and hobby stores. 

Holding everything together, 

I punched holes through the 
correplast for the zip ties. The 
neoprene compresses slightly 
under the force of the zip tie, creating 


e 4. Mini R/C transmitter schematic. 



a barrier that loose wires cannot get 
under and short circuit. I also zip tied 
the receiver antenna and all the wires 
to the same base. Zip ties holding the 
wires (cables, actually) forms a 
second strain relief. 

Modifying the 
Transmitter 

Figure 4 shows the schematic for 
what you’re about to do to the 
transmitter, while the physical layout I 
used for the transmitter is illustrated in 
Figure 5. Again, please feel free to 
modify the design as you see fit. After 


Figure 3. Mini R/C receiver diagram. 



23 





Nufs&Vous 


Personal Robotics 




making two perfboard interfaces, I 
designed a small printed circuit 
board (again, download it from the 
FTP library at www.nutsvolts.com) . 

Only three of the four switches 
are controlled by the microcontroller 
because of the reversed polarity in 
the receiver. One warning before you 

24 


start — do not screw in the antenna 
before beginning modifications. 
The weight will break the antenna 
wire from the transmitter PCB while 
you’re doing this modification. 
However, if you still manage to break 
the antenna wire (like 1 did — several 
times), set it aside and fix it later. After 
completing the transmitter hack, strip 
the insulation from the antenna wire 
back by about 1/4”. Fold the wire over 
and tin the end. Apply a fresh coat of 
solder to the antenna solder pad and 
solder the wire back onto the solder 
pad. This pad is labeled ANT on the 
top of the PCB. 

Begin the modification by 
orienting the transmitter PCB so that 
the antenna’s solder pad is located 
at the top. See Figure 5 for the proper 
orientation. Remove the red and black 
power wires from the transmitter and 
replace them with about 12” of #24 
AWG stranded wire. I used red and 
green wires for this. Strip a short 
length of insulation from one end of 
the wires and tin them. 

After tinning the ends, snip the 
wires back to about 1/8”. Hold the 
tip of the red wire against the Vcc 
pad and, with a tinned soldering iron, 
heat the pad and wire until the solder 
melts together. After the solder 
cools, give the wire a little tug to 
insure that it’s a good connection. 
Repeat this for the green wire. Cut 
two lengths of heat shrink tubing 
(about 1” long) and slide them 
over the free end of each wire. Bare 
about 1/2” of insulation from the 
remaining ends of the wires. 

The two AAA battery holder come 
with stripped ends, but I recommend 
removing additional insulation. You 
can either twist the wires together and 
solder them or do like I do and tin 
each wire separately and then press 


them together as you heat them with 
a well-tinned soldering iron. Either 
way, after the solder cools, tug the 
soldered connection slightly; you 
want to make sure there is a good 
mechanical connection. After the 
solder cools, apply heat shrink tubing 
over the soldered connection. 

Now, we’ll solder wires to the 
push button switches (the switch 
wires). The push button switch at the 
top-right of the transmitter PCB is not 
used in this modification and is 
labeled N/C in Figure 5. I used a 
DMM set to continuity check and 
identify which pads of each button 
were shorted when the button was 
pressed before I soldered wires to the 
push buttons. If you use a different 
transmitter, then you’ll need to do 
the same thing. The heavy lines in 
my diagram show where the switch 
wires are soldered to the solder pads 
of the push buttons. 

There is no need to remove the 
push buttons for this hack. By leaving 
the push buttons in place, you can 
test the transmitter manually. 
Besides, removing the push buttons 
risks damaging the PCB of the trans- 
mitter. Cut six lengths of #24 AWG 
wire to a length of about 12”. Strip 
and tin one end of each wire. Apply 
a fresh bead of solder to the four 
solder pads and pins of each push 
button, except for the N/C button. 

Lay the wires alongside two pads 
of each button, as shown in Figure 5. 
Press a well-tinned soldering iron 
against the wire and one of the solder 
pads to solder them together. Hold 
the wire in contact with the solder 
pad until the solder cools. Now, solder 
the wire to the second solder pad. 
Each wire will have two connections 
to the PCB, making the connection 
that much stronger. Finish by repeating 
JUNE 2004 





Personal Robotics 



the entire process for the 
remaining two switches. 

For the transmitter 
interface board, I used the 
276-168 perfboard. I cut a 1” 
section of perfboard, so the 
transmitter interface board 
measures 2” x 1”. As with 
the receiver interface, lay out 
the components before 
cutting the perfboard. Be 
sure to include extra holes 
for the strain relief. Once 
you’re happy with the layout, 
mark the dimensions on the 
perfboard and cut it. Sand the raw 
edges smooth before you begin 
soldering components. 

Wires from the push buttons on 
the transmitter pass through their 
strain relief holes and are then soldered 
to the emitter and collector of the 
three 2N3904 transistors. Look at the 
wiring diagram carefully. Notice 
which wires from the push buttons are 
soldered to the emitter of the transistors 
and which are soldered to the 
collectors. If you reverse these wires, 
the transmitter will continuously trans- 
mit. The push button pin labeled with a 
“G” is connected to the emitter of the 
transistor. This is the only connection 
between the transmitter and interface 
board. Now, you’re ready to add the 
connections to the robot controller. 

Cut three black wires and three 
wires of a different color. The black 
wires are connected to the emitters of 
each transistor and are for the 
connection to ground. The remaining 
three wires are soldered to the base 
resistor of each transistor. Be sure to 
use a strain relief for each wire, as 
illustrated in Figure 6. Finish the wires 
by terminating them 
appropriately for your 
robot controller. 

To complete the 
transmitter hack, you 
need to mount the 
transmitter and interface 
perfboard to a base. I 
used the same material 
and method for the 
transmitter as I did for 
the receiver; however, 

JUNE 2004 


there is one addition. You need to 
mount the antenna jack before its wire 
breaks (again!). I used a #2-56 bolt, 
nut, and washer to attach the antenna 
jack to the sheet of correplast. Before 
doing so, 1 trimmed the little extraneous 
plastic tab from the mount with a 
sharp Xacto knife. Now, you can screw 
the antenna into its jack and then zip 
tie the antenna to the base. The 
finished project is shown in Figure 7. 

Connecting the 
Radio to a BASIC 
Stamp 2 

Put batteries into the transmitter 
and receiver. For the first test, push 
the transmitter buttons and verify that 
its indicator LED lights up. Next, test 
the transmitter and receiver with a 
single BASIC Stamp. Be sure to move 
the transmitter and receiver antennas 
away from each other during the test. 
This test involves HIGHing an I/O pin 
connected to the transmitter and then 
checking the status of all of the I/O 
pins connected to the receiver. This 
test is useful for determining which 



Kronos Robotics 

and Electronics 


You Won't Believe This Web Site !! 


■Online Store 
■Free Information 
■Free Software 
■Application Notes 


•Projects 
•Forums 
•Downloads 
•News Letter 


$6.95 


$8.95 


kronosrobotics . com 


•Basic Language 

•I2c/SPI 

•IR commands 

•Hardware PWM 

•15 10 Ports 

•Hardware Serial 10 

•No External Components 

•Free Development Software 

•Chip to Chip Protocols 

•KRCompression II Technology 


Basic Language 
I2c/SPI/lWire 
IR commands 
Hardware PWM 
8 AtoD Ports 
11 10 Ports 
Hardware Serial 10 
External Components 
Free Development Software 
to Chip Protocols 
KRCompression II Technology 


$19.95 


•Basic Language DioS 
•I2c/SPI/lWire 
•IR commands 
•33 10 Ports 
•8 AtoD Ports 
•Built-In EEprom 

•Inline Assembly 
•String Variables 
•Floating Point Variables 
•Hardware Serial 10 
•Free Development Software 
•Chip to Chip Protocols 
•32K Program Space 
•2 Hardware PWM Generators 
•40Mhz Clock Speed 
•KRCompression I Technology 


Our Most Popular Package 

Athena 
EDU Deluxe 


fi 


$49.95 


Includes: 

•Athena -Buttons 

•Bread Board -Capacitors 
•Wire Kit -Resistors 

•EDU Carrier -LED's 


www. kronosrobotics. com 
703 - 779-9752 









Nuts & Volts 


Personal Robotics 


transmitter and receiver channels are 
connected to which I/O pins. 

The code I used to test my 
transmitter and receiver is also avail- 
able on the Nuts & Volts FTP library. 
I discovered something interesting 
running this test. The receiver could 
not receive signals from the transmit- 
ter unless the transmitter antenna 
was in my hand or fully collapsed. It 


appears the antenna is not effective 
when fully extended. Please let me 
know if you observe the same thing. 

The ultimate and final test is to 
send serial data over your new RF 
link. I used the transmitter code to 
transmit the letter L between two 
BASIC Stamps. The baud rate of 
my code is about six because each 
bit in the serial data stream is 150 


milliseconds long. This is not bad for 
an $8.00 transmitter and receiver. 

In my code, the receiving Stamp 
runs a loop that waits for the start bit. 
After it is received, it waits 175 
milliseconds and samples its receiver 
I/O pin every 150 milliseconds. The 
state of the pin is stored in successive 
bits of a one byte variable set aside 
for the incoming ASCII character. The 
initial long pause (175 milliseconds) 
after the start bit ensures that the 
sampling of successive bits occurs 
after the receiver has had a chance to 
settle down. If the I/O pin is sampled 
too close to the start of a bit, 
the receiver may not have time to 
settle down, leading to the bad 
transmission of data. 

After receiving each bit, a one is 
added to the bit value. This flips (or 
toggles) the state of the bit. Toggling 
the bit is necessary because the receiver 
flips the sense of the bit that the 
transmitter is sending. The BASIC 
Stamp doesn’t suffer from variable 
overflows. So, when a variable stores a 
number larger than that variable is 
defined, the neighboring variable is not 
destroyed. The BASIC Stamp has a 
command to toggle bits, but I think this 
method is a more entertaining way to 
do it. It kind of catches you off guard. 

In a later test, I was able to knock 
the bit length for every bit down to 100 
milliseconds, except for the first bit 
transmitted. It seems that a shorter 
first bit prevents the transmitter from 
transmitting that bit properly. If it’s 
important to transmit at 10 baud, I 
recommend making the start bit 150 
milliseconds long and the remaining 
eight bits 100 milliseconds long. 

With three channels, you can 
send data between three robots using 
what I call channel multiplexing. The 
RF frequency used between all three 
robots is the same, but the frequency 
of the square wave sent over the RF 
link varies. It’s the frequency of the 
square wave that determines which 
channel the data is transmitted and 
received on. 

I hope you find this hack useful; I 
plan to build a three robot project this 
summer to use the radios. NV 



MADE SIMPLE 

BRING YOUR WIRELESS PR00UCT QUICKLY ANR LEGALLY TO MARKET 

WHmIIF 




CDBGD 5KB05W3PS 

I Handheld TX's Keyfob TX's Function Modules - 

1 S © @© 


Specialty GPS 


keyless entry to WIFI. 


lyagis, 

ii. 


Embedded Chips 


'LVJIJif 


Prouillv Distribute 1 1 by. 



JUNE 2004 





JUNE 2004 


27 























Nuts' ¥ Volts 


Q&A 


with TJ Byers 


Electronics Q&A 


In this column, I answer 
questions about all aspects 
of electronics, including 
computer hardware, 
software, circuits, electronic 
theory, troubleshooting, and 
anything else of interest to 
the hobbyist. 

Feel free to participate 
with your questions, as 
well as comments and 
suggestions. 

You can reach me at: 
TJBYERS@aol.com 

What's Up: 

All about relays: 
low-power operation, 
low voltage operation, 
and AC coils operation. 
Two projects on the 
lighter side and sidacs 
defined. Photo websites 
and lots of feedback 
from our readers. 

28 ^ 


About Relays 

Q . I would like to build the 
‘Precision On/Off Timer” 
described in the May 2004 column, 
but you didn’t specify what relay to 
use. What were you thinking? 

John O’Hara 
via Internet 

I had in mind the RadioShack 
75-005 or something equivalent. 
Actually, the relay isn’t as critical as 
you may think. Electromechanical 
relays (which include reed relays) are 
current operated — not voltage 
operated. Inside the relay is an 
electromagnet — turns of wire wound 
around a soft iron core — that’s in 
close proximity to a hinged metal 
armature (Figure 1). Running current 
through the coil pulls the armature 
toward the electromagnet and makes 




Reducing Relay Coil 
Power Consumption 



(a) (b) 


contact with the NO (normally open) 
electrical contact. 

The force required to pull-in the 
armature is determined by the 
ampere-turns around the iron core. If 
a relay needs 10 ampere-turns to 
operate, you can put 10 amps 
through one turn or one amp through 
10 turns; 100 mA through 100 turns 
or 10 mA through 1,000 turns. 

Since copper wire has resistance, 
the more turns you have, the longer 
the wire and the more the resistance. 
It’s the resistance of the coil that 
determines the operating voltage of 
the relay. 

For example, a relay with a 500 f2 
coil and a pull-in current of 10 mA 
requires at least 5 volts to operate, but 
it will also work at 10 volts (20 mA) or 
15 volts (30 mA). The upper voltage 
limit is determined by the heat 
build-up in the coil. Ifu the current 
(heat build-up) is more than the relay 
can handle, simply insert a resistor in 
series with the coil. 

In reality, most relays will pull-in 
at 90% of the rated current (9 mA at 
4.5 volts in our example). Once the 
armature pulls in, though, less 
current is needed to hold it in place. 
In fact, some armatures won’t 
disengage until the current is less 
than 10% of the pull-in value. We can 
use this to our advantage to reduce 
the holding current once the relay is 
engaged. If the current is reduced by 
two thirds, you save about 67% on 
power. This is definitely an advantage 
when using relays with battery 
operated equipment. Figure 2 shows 
two methods. 

In method (A), full current will 
flow through the relay while Cl 
charges. When fully charged, the cap 
appears as an open circuit and the 
current is now limited by Rl. The 
disadvantage of this is that — if the 
JUNE 2004 


Q&A 



—[—0.15 ~|3~ 


3-Volt Relay 




AC Relay Coil 


armature is dislodged by vibration or shock — there won’t 
be enough current to pull it back in. Method (B) solves that 
problem, but requires an extra set of contacts. Capacitor 
Cl maintains a voltage across the coil during the switching 
transition to prevent chatter. 


More Relay Stuff 


Q . I need to operate a relay-controlled circuit from a 3 
volt battuery, but 3 volt relays are about as scarce as 
hen’s teeth. So, I’m wondering, is there a way to use a 5 
volt reed relay from a 3 volt source? 

Tom Edwards 
via Internet 

. If you’ve been following the above (“About Relays”), 
^^you’ll know that what’s needed is a short burst of 
energy to engage the coil: that is, a temporary boost in 
voltage from 3 volts to 5 volts. After that, the relay will hold 
its own. What I’d use is a capacitor that’s been charged to 
Vcc and add it in series with the relay coil to generate a 
burst of 2 x Vcc volts to engage the relay. 

Basically, what I’m going to do is put a charged cap in 
series with the 3 volt source to generate about 6 volts that 
will pull-in the relay. 

After that, the relay will remain closed, so long as the 
3 volt source remains. There are a lot of ways to do this, 
but the simplest I’ve found is one using Maxim’s MAX4624 
analog switch, as shown in Figure 3. For it to work, the 
charging time of Cl must be longer than the charging time 
of C2; i.e., C2 must be fully charged before the analog 
switch turns on. 

AC Relays Are a Shady Deal 

Q . Could you please explain the difference between a 
DC relay coil and an AC relay coil? This has been 
bugging me for many years and I haven’t been able to find 
an explanation. 

Lee Marker 
via Internet 


A * AC relays are generally 
^^constructed like DC 
electromechanical relays with 
a portion of the core pole face 
separated from the rest of the pole face and enclosed in a 
loop of copper (Figure 4). This loop — called a shaded pole 
— produces a lag in the timing of the AC magnetic flux 
between the faces of the pole. While the current in the 
coil passes through zero twice each cycle, the flux in the 
armature gap remains at a high enough level to hold the 
armature in place. 

The current drawn by a shaded pole relay is 
determined by the AC impedance of the coil at the power 
line frequency, which depends on the coil construction and 



300,000+ Electronic Components 
Over 1 ,000,000 Cross References 


New Suppliers, 

New Technologies, 

New Catalog Every 90 Days! 


MOUSERi 

ELECTRONICS 


(800) 346-6873 www.mouser.com 


JUNE 2004 




NutS&VOLTS 


Q&A 



Analog Integrators 



the armature position. 

For example, the impedance of 
a relay may be twice as large with 
the armature engaged as with it 
deenergized. Consequently, the window 
between the pull-in and drop-out 
currents is much narrower than with 
a DC relay. Some relays can’t remain 
energized or may chatter badly if the 
coil current drops to half of the rated 
pick-up value. 


I’m Leaving on a 
jet Plane 

Q I want to replace my lost 
‘LOTCJS” Wallace Jetset- 
Airdaptor. This product is designed 
to convert an airline’s air-pipe sound 
system into an electrical signal. 

In practice, one inserts the yellow 
connector and the short tubing from 
the Airdaptor into the outlet on the 
seat arm. You then insert the plug of 



your personal stereo 
headphones into the 
Airdaptor’s output 
socket. You can 
now hear the airline’s 
entertainment. 

I originally pur- 
chased mine from 
Markline Warehouse in 
Bristol, PA. No, they do 
not have them 
anymore. Do you 
know where I can find another one? 

Ed Knorr 
via Internet 

A The last time I flew (last summer 
o Hawaii), the connection was a 
dual, 3.5 mm phone plug with 
electronic earphones — not the 
air-powered headsets of yesteryear. If 
you don’t like the airline’s earphones, 
you can buy an Earhugger EH A- 18 
earphone adapter (Figure 5) that 
lets you plug your own stereo 
headphones into the airline jack. 
They are available from several 
retailers and sell for as little as $3.00. 

Let There Be Light 

Q . In the March 2004 issue, you 
showed an instrument which 
seems to be able to reform the 
majority of my “cap box” devices. 
The required components are readily 
available, but (of course, there’s 
always a but), I cannot find the 
reforming light identified as 1490 in 
any of my catalogs. Do you know 
where I can get a few or would you 
share the intended operating voltage 
and current for this device with me 
so I can get one that is close? 

Bob Bates 
via Internet 

A Back when 1 was a kid — just 
hortly after the world ceased to 
be flat — we used pilot lamps instead 
of LEDs to indicate when an 
electronic device was powered on — 
or in the case of the 1490 lamp, to 
illuminate the dial of my 1965 Dodge 
car radio. 

Unlike LEDs, pilot lamps 
JUNE 2004 


Q&A 


produce light by heating a tungsten wire (filament) white 
hot by running current through it. In this circuit, I’m using 
that wire to indicate when current is flowing to reform 
the capacitor. If and when the capacitor is fully reformed, 
no current will flow through the lamp and it will cease 
to glow. 

So, as you can see, it’s merely an indicator and not 
critical to reforming the cap itself. The 1490 is rated 3.2 
volts at 0.16 amps. Most auto part stores should carry this 
bulb. If not, try to find a PR-9 bulb — often used in 
flashlights. If all else fails, just don’t use a bulb at all (short 
it out) and guess when the cap no longer draws current. 

Photo Tachometer 

Q . About your “Another Zero-Crossing Detector” in the 
October 2003 column: Can the circuit described in 
Figure 3 be adapted to a 12 volt tachometer circuit? That 
is, can the input be changed so it looks at a rotating, 
segmented black and white wheel on the end of a rotating 
shaft (instead of the bridge input) and the entire circuit be 
run on 12 volts instead of 5 volts? 

AlanTurof 
via Internet 

A Simply replace the 4N25 optoisolator with a photo- 
ransistor. To increase sensitivity and reduce noise, I 
put the phototransistor at ground level and moved up the 
“biasing” resistor to Vcc (Figure 6). Every time the 
transistor sees white, the 555 monostable multivibrator 
outputs a 240 gS pulse. To change the width of the output 
pulse, adjust the values of R1 and Cl using the formula: 
t= 1.1(R1 x Cl). 

To make it a tachometer, though, you need to count 
the pulses. This can be done using a digital frequency 
counter or an analog integrator. Figure 7 shows two types 
of analog integrators. The circuit on the left side of Figure 
7 shows a simple circuit that uses a panel meter as the 
integrator. In this circuit, the inertia of the needle smoothes 
out the lows and highs, giving an average value of the 
output voltage. 

The circuit on the right side of Figure 7 is an R/C 
integrator that lets you replace the panel meter with a 
DVM. The amount of integration is dependent upon the 
values of R1 and Cl, which are also dependent upon the 
time constant of the circuit. As a rule of thumb, the time 
constant should be at least 10 times greater than the time 
duration of the input pulse for integration to occur. 

Mower Ignition Fix 

Q . I have an old mower tractor with a Tecumseh engine 
and a 12 volt battery system. The solidstate ignition is 
bad and they no longer sell a replacement part for it. Is 
there a way I could build a circuit that would charge a 
capacitor that the trigger coil would discharge to the pulse 
JUNE 2004 


transformer each cycle? 

Don 
via Internet 

A . What you have there is a capacitance discharge 
gnition (CDI) that’s commonplace in today’s 
automobiles. What you do is charge a capacitor with a high 
voltage (about 320 volts), then discharge it through the 
pulse transformer. The result is about 50,000 volts that 
jump across the gap of the spark plug and ignite the 
gas/air mixture in the cylinder. 

The input coil of the original system is what created 
the high voltage, while it was the trigger coil that told a 
silicon-controlled rectifier (SCR) to discharge the capacitor 
at the right moment for proper ignition timing (Figure 8). 

Only the pulse coil and trigger coil have to be salvaged 
from the old module to make a working replacement (Figure 9). 
The high voltage is now generated by Tl, a 12 volt, center- 
tapped power transformer (RadioShack P/N 273-1511) in a 
reverse configuration. That is, the secondary is the low 
voltage, 12 volt input and the primary is the high voltage AC 
output that, when rectified, charges the CDI discharge cap. 

Three 555 timers generate the 12 volts AC needed by 
toggling the power transistors on and off so that only one 
transistor is conducting at a time. The master 555 uses the 





Looking For A Cost-Effective Way to Extend 
range and reliability of your wireless product? 

The Linx LR Receiver provides a dramatic increase in range over 
other RF solutions while maintaining full FCC compatibility. 


mum : 


Features: 

• Long Range 

• Direct Serial Interface 

• Data Rates to 10,000bps 

• No External Components 

• Low-Cost 


• Low-Power Consumption 

• Wide Supply and Temp Range 

• RSSI and Power-Down Functions 

• Compact SMD Package 

• FCC Part 1 5 Compatible 


TECHNOLOGIES 



NufS&VOLTS 


Q&A 



reset (pin 4) and trigger (pin 2) 
inputs of the timers to alternately turn 
on and off the slave 555s . 

Let There Be 
(Street) Light 

Q . Can you suggest a circuit that 
uses a photocell to turn on a 4 


kW incandescent light at night? It 
should have an adjustable “on” time 
from three to six hours, then turn off 
and reset for the next day. 

Thomas V. Wahl 
Pekin, IL 

I considered three designs 
efore deciding on this circuit 


(Figure 10). The timer is built around 
two digital dividers. The first — a 
4060, 14-stage ripple counter — 
provides the main clock. This chip 
has a built-in oscillator. The oscillator 
— with a frequency set by the 
100K/0.68pF resistor/capacitor 
combination — outputs a pulse to the 
4017 every 36 minutes. 

When light falls on the phototran- 
sistor, it conducts and places a logic 
1 (high) on the MR pins, which, in 
turn, resets all the counters to a logic 
0 state. When the sun goes down, the 
counters start and light the lamp for 
the time selected by the DIP switch. 
Just make sure there is only one 
switch turned on or the shortest- 
timed switch will dominate. 

The rising sun resets the counters 
and readies them for the next dusk 
cycle. Oh, don’t forget to heatsink the 
triac and don’t let the AC get close to 
the DC, which is nothing more than a 
9 volt battery or wall-wart. 

Dump Those Temps 

Q . I am running windows 98SE. In 
the DOS mode, I went to C:\ 
windows\temp and found that I have 
375 files in my “TEMP” folder, which 
JUNE 2004 


rial EEPROM | FLASH EPROM | 


| Most MCU's | Low Voltages t 



controllers such as 87/89xxx, PIC 
AVR, ST62, etc. Low voltage 
devices down to 1.3V. No adapter 
required for DIL devices. 8 Hrs. 
operation on battery (AC charger 
included). Runs WIN 98, NT, ME, 
2000, XP with Hex/Fuse Editor. 


Effectively substitutes high priced 
universal programmers e.g. ALL-11 
(HILO) or LabTool-48 (ADVANTECH) 
Provides virtually matching perfor- 
mance at only 1/3-1/5 the price. 
For info, orders or software updates 
call: 619-702-4420 


Galep-4 employs ASIC universal 
pin technology for each pin of the 
40 pin ZIF socket. 5, 500+device 
library/free updates. Handle 8/16 
bit EPROM'S, EEPROM's, 0-power 
power RAM, FLASH, Serial EE- 
PROM's, GAL's, PALCE, micro- 


One Small Programmer handles 5,500 devices. 
Introducing the diminutive GALEP-4 




Q&A 


are using 37 MB of hard disk space. 
There are 230 files serially numbered 
from HPH1 through HPH230 (no 
extension), plus quite a number of 
files with extensions .tmp, .log, and 
.txt. I’ve been told that those files can 
be deleted without affecting my 
computer operation. 

Is it true that I can delete all of the 
files in the TEMP folder without a 
problem? Are there any that I should 
leave? 

Curt 
via Internet 

A . Indeed, anything in your 
^^Windows\temp folder can be 
deleted. Check out the Disk Cleanup 
feature in Windows 98; it targets 
this folder (but doesn’t empty it 
completely), as well as a couple of 
other areas that tend to accumulate 
files. Find Disk Cleanup in your My 
Computer icon under the C: drive. 
Right click on the open space to the 
left and choose Properties. 

MAILBAG 


Dear TJ, 

I don’t mean to split hairs, but 
your answer to the person with the 
sound card problem (April 2004) 
doesn’t correctly identify the 
problem. The A/V system(s) aren’t 
really “expecting” any particular 
input impedance and don’t really 
care what the output impedance of 
the sound card is — it can be anything 
from zero to several 10s of KQ, 
depending on cable length and signal 
level concerns. 

What is needed, your answer 
does provide — ground circuit 
isolation and a boost in signal level. 
Your solution is great, but I found the 
explanation emphasizing the wrong 
issue. 

Dick Moore 
via Internet 


Dear TJ, 

Robert G. Blazej (April 2004) 
should also be advised that, for much 
less than $100.00 he can substitute a 
JUNE 2004 



woofer and the accompanying two 
tweeters for the existing speakers on 
his computer. Atec is one of the 
manufacturers. 

I bought their set for $30.00 and 
1 love to see people’s reactions when 
they hear it play. I have to show them 
the woofer under my desk and the 
two small speakers behind the 
monitor. 

Bill Lawson 
via Internet 


Response: I bought my Altec 
PC subwoofer system from 

www.store.iiahoo.com/csfostore 


for $9.95 and I love it — albeit that 
the wiring can get very 
tangled. 

However, I also have a PC 
connection to my A/V system, too, 
which is an ongoing interface 
experiment between my PC and an 
ultimate A/V experience. 

-TJ 


Plug it in for Control! 

Here is just jhe right computer module you want! N%W _$89 
Plug it in y our protoboard, or your own PC B design. 

You get a HldlPs DSP-core controllcj you can 

program in high level language. The multilayer, 
high-density, fine-lin ed, SMT, circuit design is 
already done for you. Just wire the few extras, drop 
in the Plug-a-Pod™, program, . . . and you’re ready ! 



Plug-a-Pod™ 

Make YjMM^n 2-layer interface 1HBH at and complexity of a 

larger multilayer board with a processor would be. Pick exactly the connectors you 
need. Add power circuits, isolation, or any particulars of your application. Plug-a- 
Pod™ fits in less than 2 sq in. The two dual-row . 1 ” pinouts makes connection to 
your circuit boardHH^^^^^^H Drop in a Plug-a-Pod™, to bring it all to life. 


One of several award-winning ‘Pod products from NMI 


Call on Plug-a-Pod™; 


Tel;214-339-2204 




Q&A 


Dear TJ, 

I always enjoy reading your 
column and think your vibrator 
replacement is great! 

However, if Carl doesn’t want to 
build one, he can buy them from 
Antique Electronic Supply, Tempe AZ 
(www.tubesandmore.com) . They 
have several types, 3 or 4 pin, 6 or 12 
volts, pos or neg ground — ranging 
from $16.95 to $29.95 — much less 
than the $40.00 he mentioned. 

Jim 

via Internet 

Dear TJ, 

I was looking at the March 2004 
issue and I found an error in the circuit 
of Figure 8. The first two resistors are 
marked 100K — which set up the 
voltage divider — should be 10K. At 
100K, the circuit doesn’t oscillate. 

Steve Jacob 
Principal Engineer 
Raytheon Missile Systems 


Response: I tested this circuit 
using an LM2904 opamp and it 
worked quite well. The reader is 
happy with it, too. 

In fact, this design even works 
with a 1M voltage divider (I used 
these values in an upcoming 
column for a low-battery indicator). 
The values are not critical to the 
circuit as long as they are equal so 
that the tap forms a pseudo 
ground. 

All I can think of is that your 
opamp has a low input impedance 
(perhaps an LM3900), in which 
case it would require a I OK 
divider. Bottom line: Go with what 
works. 

-TJ 

Steve’s Response: Yep, I was 
using a very old 741 equivalent I 
had kicking around in my junk 
box (and probably a surplus one at 
that). This just shows you how fast 


opamp parameters are improving 
in this fast-paced semiconductor 
age. NV 

Cool Websites! 

Into digital photography? Check out 
these free image handling utilities. 

www.prismaticsoftware.com/Utility/ 

Utilitv.html 

Fine tune, store, and edit your digital 
photos. Free courses from HP. 

www.hponlinecourses.com/?mclD= 

smbem 

The Digital Darkroom Software 
Center: A comprehensive listing of 
popular digital photography software 
that you can try before you buy. 

www.shortcourses.com/software/ 

index.html 


High Resolution PC Oscilloscope 


£ 

£ 



• High speed, 5GS/s dual channel oscilloscope 

• 50MHz, 80dB dynamic range spectrum analyser 

• PicoScope & PicoLog software supplied FREE 

• Plug into any desktop or laptop PC 

• High resolution - 12 bits 

• Large 128K memory 

• 1% DC accuracy 


www.picotechxom/scopel 66 


Tel: 585 425 3753 Fax: 585 425 3835 E-mail: sales@picotech.com 


Request your FREE Test & Measurement 
catalogue and Software & Reference CD, or visit: 


34 


JUNE 2004 




16 CHARACTER X 2 LINE LCD 
WITH LED BACKLIGHT 

EDT # EW162C 
16 character X 2 line 
LCD module with LED ___ 

backlight. 5 x 7 dot characters. 

Module size: 3.35" X 1 .41” X 0.52”. 

Display size: 2.5” X 0.63". 

Includes hook-up diagram. 

CAT# LCD-97 ^ *\J each 


$10 


25 


CIGARETTE LIGHTER 
COIL CORD 

Good-quality coil 
cord with 
cigarette lighter 
plug one end, 

2.1mm coax 
plug other end. 

Plug has LED indicator and removable 2 Amp 
AGC fues. Extends to 6 feet. CAT# CLP-68 



$Q25 

each 


4.5” 24 OHM SPEAKER 

4.5" paper cone 
speaker with 5.6" 
metal mounting 
frame. 2.6" deep. 

Mounting holes are 
on 3.75" centers. 

CAT# SK-4524 

$1ih 



1.5-6 VDC JOHNSON MOTOR 

1.38" long. 


Johnson Motor. 0.78" > 

0.08" (2mm) diameter 
0.33" long shaft. 10,000 RPM 
@ 3 Vdc @ 40 mA (no-load 
rating). Solder-lug terminals. 
CAT# DCM-189 


9 


2<°$1 


QQ 


120 for 420 each 
480 for 380 each 
960 for 340 each 


3.6V AA LITHIUM BATTERY 

SAFT # LSI 4500. 3.6 Volt, AA Size lithium 
with axial leads. 0.55" diameter x 2" long 
with wire leads extending another 1 .6". 

CAT# LBAT-40 j 75 

| 10 for $15.00 | 


ULTRASONIC TRANSDUCER 

Matsushita #0D24K2. 

0.95" diameter x 0.38" metal case. I 
0.65" long pc leads on 0.4" centers.^ 

CAT # XDR-24 ^ ^ 25 


| 10 for $1.00 each~| * I each 

LIQUID LEVEL ALARM 1C 




ST Microelectronics # L4620. 

An integrated circuit designed for 
the liquid level control in automotive applica- 
tions. The liquid level is determined by the 
attenuation between transmitted and 
received signals across a sensor tip in the 
liquid. If the attenuation exceeds an internal 
threshold - sensor tip outside the liquid or 
liquid temperature higher than a determined 
value - a square-wave alarm output indi- 
cates an insufficient liquid condition. Internal 
circuits prevent spurious indications, and a 
latch keeps the alarm activated until the sup- 
ply voltage is switched off. 8-pin dip pack- 
age. Spec, sheet available on our web site. 
CAT# L4620 $420 

*** I each 


| 50 for $1 .00 each ] 


8 MM VIDEO TAPE (USED) 

(120 minute) video 
cassettes. Top-of-the-line, 

Sony or Fuji (depending 
on availability), metal 
particle cassettes, used 
for a short time, then bulk erased. 

Includes plastic storage box. CAT# VCU-8 

$000 r 10 for $2.80 each I 

^0"each 1 100 for $2.50 each | 




12 VDC 0.9 AMP SWITCHING 
POWER SUPPLY _ 

Phihong 
# PSA-1 0L-1 20 
Input: 

100-240 Vac 
Output: 12 Vdc 0.9 Amps 
Low profile, open-frame switching supply. 
4.15” x 1.95” x 0.78” high. Regulated. 
Overvoltage protection. Overcurrent 
protection. UL, CE. CAT # PS-129 
$oz 5 r 10 for $3.50 each I 

each \ 90 for $2-50 each | 



16 BUTTON INDOOR/ 
OUTDOOR KEYPAD 

Fully-sealed, tactile snap-dome 
contacts. Contacts rated 30 mA | 

@12 Vdc. Ten black keys 
numbered 1 to 0 (and A to J). 

Five blue keys with up-down arrows (also 
right-left), CLEAR, HELP and ENTER. 

One red key labeled 2ND. TTL, MOS and 
DTL compatible. 4x4 buttons (2.7” x 3” x 
0.36"). 9-pin headers, 0.1” spacing. 

0 

each 


CAT # KP-23 
| 10 for $11.50 each 


i $12? 


2 AA CELL NIMH PACK 

2.4 Volt, 1500 MAh nickel metal 
hydride battery pack. Two AA cells 
with a 2-conductor female 
connector on 2" leads. Used in 
many cordless phones. $000 
^ each 


CAT# NMH-2AA 


SPECIAL QUANTIT Y PRICING 
GREEN T-1 3/4 LED 

Liteon# LTL-307G. Our lowest price ever on stan- 
dard green 5mm diameter (T-1 3/4) LEDs. Green 
diffused, standard brightness LEDs. 

Clean, full-leaded devices. 

CAT # LED-2 


100 for 120 each 
1,000 for 50 each ($50.00) 


10f°r$“|5Q 


shop on-line www.allelectronics.com 

ORDER TOLL FREE 1 - 800 - 826-5432 


FAX (818) 781-2653 • INFO (818) 904-0524 

E-MAIL allcorp@allcorp.com 


El 


MAIL ORDERS TO: 

ALL ELECTRONICS CORP. 

O. BOX 567 • VAN NUYS, CA 91408-0567 


NO MINIMUM ORDER ■ All Orders Can Be Charged to Visa, Mastercard, American Express or Discover • Checks and Money Orders Accepted by Mai 
Orders Delivered in the State of California must include California State Sales Tax ■ NO C.O.D • Shipping and Handling $6.00 for the 48 Continental Ui 
States -ALL OTHERS including Alaska, Hawaii, P.R. and Canada Must Pay Full Shipping • Quantities Limited • Prices Subject to change without no 


MANUFACTURERS - We Purchase EXCESS INVENTORIES... Call, Write, E-MAIL or Fax YOUR LIST. 


JUNE 2004 


35 




Nuts & Volts 


New Product News 


A COOL NEW BOOK 

W ritten by best-selling investigative author Lee Lapin, 
How to Get Anything on Anybody, Book 3 
includes 600 pages of the latest federal level electronic 
surveillance, people tracking, and asset searching. PI 
Magazine wrote, “Simply an unbelievable ‘must have’ 
information guide for investigators.” Cost is $99.95 with 
free shipping. CA residents, add sales tax. 

For more information, contact: 

INTELLIGENCEHERE.COM 
Tel: 866-885-88S5 
Web: www.intelligencehere.com 


HOME AUTOMATION 
SOFTWARE CONTROLS 
MID-HUDSON NYC BRIDGE 
LIGHTS 

H omeSeer Technologies, 

LLC of Bedford, NH - 
specialists in home automa- 
tion control systems — 
announced that their soft- 
ware was chosen to control 
lighting on the Mid-Hudson 
Bridge, NYC, by remote 
control. It was selected 
because of its wide variety of 
controllers, all of which work 
via the Internet, and because 
it could be readily customized 
for the application. 

HomeSeer VI. 7 Home 
Automation Software features an intuitive web control 
capability that lets users control lighting and appliances in 
their home from anywhere in the world via the Internet 
from a browser, telephone, PDA, or cellular phone. 

Adapted for use on the Mid-Hudson Bridge to provide 
remote on/off control and scheduling for different 
sections and colors of lights, this Windows® based 
software eliminates the need to create a custom 
program. 

Suitable for a variety of remote applications, 
HomeSeer VI. 7 Home Automation Software is also ideal 
for controlling irrigation systems. It can trigger events 
based upon a wide range of mechanisms and can 
perform actions, such as running scripts, sending Emails, 
and dialing a phone. 

HomeSeer VI. 7 Home Automation Software sells for 
$149.95 and a free, 30 day trial can be downloaded from 
the HomeSeer website at no cost or obligation. 

36 



For more information, contact: 

HOMESEER TECHNOLOGIES, LLC 

109 Powder Hill Rd. 

Bedford, NH 03110 

603-471-2816 Fax:603-471-9128 
Email: kfranz@homeseer.com 
Web: www.homeseer.com 


ETHERNET STARTER KIT 



I magine Tools 
launched its 
Ethernet Starter 
Kit, which takes 
an application- 
based approach 
for adding value 
to the product. 

Several practical 
application notes 
can be downloaded from the Imagine Tools website for 
innovative Ethernet uses of this embedded control system 
kit. 


Applications specific to this kit include an X-10 
household automation, Ethernet proximity sensor, 
web-controlled thermostat, network lighting control, and 
more. The Ethernet starter kit is designed to bring the fun 
into both TCP/IP training and offer a low-cost solution for 
veteran users who are looking for an embedded controller 
that is simple to use. 

Imagine Tools plans to grow its business based on 
user-contributed designs. As the number and scope of 
applications increases, greater value is added to the 
Ethernet Starter Kit for users to take advantage of. 
Imagine Tools is seeking to publish any practical or fun 
applications created by users. Users whose applications 
are published on the Imagine Tools website will receive 
rewards based on the “cool factor” of the application and 
the number of working applications from that particular 
user. Submission criteria are: a working application with a 
wiring schematic, list of materials, sample C program, 
and brief overview of the application. 

The Ethernet Starter Kit is built around the Rabbit 
Semiconductor R3000 microprocessor. This eight-bit 
platform is designed specifically for embedded control 
systems and is also used in Rabbit Core Modules. The kit 
contains a starter board for prototyping and wiring 
various applications to the core module included in the 
kit. Dynamic C Lite is a free, simplified educational 
version of the industry-proven Dynamic C Integrated 
Development Environment for use in the kit. This free C 
language compiler provides a simple interface to program 
and run applications. 


JUNE 2004 





New Product News 


For more information, contact: 

IMAGINE TOOLS 

2900 Spafford St. 

Davis, CA 956 1 6 

Email: info@imaginetools.com 
Web: www.imaginetools.com 


TRUE ANALYSIS OF AN 
ASYNCHRONOUS SERIAL LINK 

O ne of the most widely used ' 
and popular interfaces in t 
world today is a serial link. 

Smartronix, Inc., engineers ' 
have developed a very inform- 
ative, yet simple device to 
monitor, evaluate, and i 
measure asynchro- W' i 
nous serial links — 
the SMTRX-026 Serial Analyzer. 

Captured data is stored 
precise time-tags, error status, and handshake line states to 
troubleshoot a full duplex link. The 
device allows the host PC to mimic a 
serial device while capturing the data 
transaction, to store the full duplex data 
from DTE and DCE ports. It also allows 
the serial link to pass straight through 
the base unit without retransmission, 
distortion, or delay. The unit also 
measures serial transceiver voltages to 
indicate line driver problems. 

The unit can be connected 
preferably by USB or by a standard 
COM port to a host computer. 

Windows® software is provided to 
control the base unit, download and 
analyze captured data, and to 
emulate serial device operation. The 
captured data can then be exported 
to tools, such as Word or Excel. All 
cables and adapters are included to 
connect to standard 9- and 25-pin 
DTE/DCE devices. 

For more information, contact: 




THE WORLD’S SMALLEST 
MICROCONTROLLER 

M icrochip Technology, 

Inc., has released the 
world’s smallest microcon- 
trollers — six-pin packages 
packing the high performance 
of the PIC microcontroller 
architecture into the ultra- 
small form factor of a SOT-23 
package for space-constrained, low-cost applications. 

The PIC 1 OF eight-bit Flash microcontroller family 
debuts with four members (PIC10F200, PIC10F202, 
PIC10F204, and PIC10F206) that offer 256 to 512 
instructions (xl 2-bit program words) of Flash program 
memory and 16 to 24 bytes of data RAM memory. These 
devices also feature a precision 4 MHz internal oscillator, 
33 instructions, two stack levels, 25 mA source/sink 
current I/O, low power (100 nA) sleep current, a wide 
operating voltage range from 2- to 5.5-volts, one eight-bit 
timer, a watchdog timer, In Circuit Serial Programming™ 
(ICSP™) technology, power-on reset, power-saving sleep 
mode, and (in the PIC10F204 and PIC10F206 only) an 
analog comparator module. With only six pins, they have 


SMARTRONIX, INC. 
CALIFORNIA, MD 
866 - 442-7767 
Fax: 301 - 866-0528 
Email: sales@smartronix.com 
Web: www.smartronix.com 


Learn programming and 
networking by doing it! 



Ethernet Starter Kit 

C-Programmable 8-bit Rabbit 3000® 
Microprocessor core module with Ethernet, 
experimentation board, and Dynamic C Lite 
with compiler, editor, and debugger. 


Included Application Notes: y 

•X-IOWeb Based Home Automation 

• Ethernet Proximity Sensor 
•Web Controlled Thermostat 

• Network Lighting Control 



Think 

Learn 

Build 


JUNE 2004 




siiOAf SION 


New Product News 


a short learning curve for beginners to design with micro- 
controllers. 

Through ICSP technology, these devices can be pro- 
grammed after placement on a circuit board, enabling field 
upgrades, system calibration during manufacturing, and 
the addition of unique identification codes to the system. 

The PIC 1 OF family is ideal for applications requiring 
low pin-count microcontrollers. The small form factor, high 
performance, and low-cost is creating new applications not 
traditionally served by microcontrollers: 

“Electronic Glue”: Discovering a bug in an ASIC or a 
PCB can have devastating consequences for the design. 
By including PIC 1 OF devices in a PCB design from the 
start, bugs, late changes, and other stopgaps can be 
implemented with ease and little expense for ASICs, the 
board itself, and for a number of other devices on the PCB. 

Logic Control: Traditional standard logic and timing 
components — such as delays, smart gates, signal 
conditioning, simple state machines, encoders/decoders, 
I/O expanders, and small peripheral logic functions — can 
now be integrated into a six-pin microcontroller. 

Waveform Generation: As with replacing standard logic 


devices, a PIC 1 OF microcontroller can take the place of 
traditional 555 timers, pulse-width modulators (PWMs), 
remote control encoders, pulse generation, programmable 
frequency source, resistor-programmable oscillators, and 
much more. 

The PIC 1 OF family is supported by Microchip’s 
development tools, including the MPLAB® In-Circuit 
Debugger (ICD2) development tool. The MPLAB ICD2 is a 
powerful, run-time tool that offers cost-effective, in-circuit 
Flash programming and debugging from the graphical 
user interface of the free MPLAB Integrated Development 
Environment (IDE) software. This enables a designer to 
develop and debug source code by watching variables, 
single-stepping, and setting break points. Running at full 
speed enables hardware tests in real time. 

These devices are offered in six-pin, SOT-23 packages. 
General samples are available and volume production for 
all four microcontrollers is expected by July. In 10K 
quantities, the PIC10F200 is $0.49, the PIC10F202 and 
PIC10F204 are each $0.57, and the PIC10F206 is $0.65. 

For more information, contact: 

MICROCHIP TECHNOLOGY, INC. 

Web: www.microchip.com 








CALL TOLL-FREE 


(800) 292-7711 
Orders Only 


C&S SALES 

Secure On-line Ordering @ cs-sales.com 

FREE GIFT with online purchase (use coupon code NV) 


64 PAGE CATALOG! 
(800) 445-3201 


Capacitance Meter | [ 


Digital Multimeters 


Elenco Snap Circuits™ 


Elenco Model M-1750 

; 24. 95 



Elenco Model LCM-1 950 

$ 59. 95 


Elenco Model CM-1 555 

ID s 29. 95 


Elenco’s new Snap Circuits™ make learning electronics fun and easy. Just 
follow the colorful pictures in our manual and build exciting projects, such as: 
digital voice recorders, AM radios, burglar alarms, doorbells, and 
much more! You can even play electronic games with your friends. All parts are 
mounted on plastic modules and snap together with ease. Enjoy hours of 
educational fun while learning about electronics. No tools required. Uses “AA” 
batteries. 

5 versions available. 

Build up to 500 projects! 

As low £ 

r$29.95 


Test Equipment 


Elenco Quad Power Supply 
Model XP-581 

I Fully Regulated Power Supplies in 1 Un 


[,bb7i $ 75 



© 


Elenco Handheld 
Universal Counter 
1MHz -2.8GHz 




Create 
Your Own 

Exciting Experiments 
Special Offer: Purchase any of our Snap Circuits and receive a FREE computer 
interface kit (Model CI-21) & 20 bonus experiments ($19.95 value). 


Features 10 digit display, 16 segment 
and RF signal strength bargraph. 
Includes antenna, NiCad battery, 

AC adapter. 

C-2800 Case w / Belt Clip Si 4.95 


Models Available 


Elenco RF Generator 
with Counter (tookHz-isoMHz: 

Model SG-9500 


$ 239 


SG-9000 (analog, w/o counter) $135 


Elenco 3MHz Sweep Function 


and TTL, CMOS pulse. $1 gg 9 5 

GF-8025- Without Counter $99.95 


Elenco Educational Kits 


Model FG-600K 






Deluxe Soldering Irons 


Electronic Science Lab 


Elenco SL-5 Series 



n. Model SL-5-40 - Incl. 40W UL iro 

$24 95 (Kit SL-5K-40) $2g 9 


Weller® Low Cost 
Soldering Iron 
Model WLC100 


Maxitronix 500-in-1 Electronic Project Lab 

Model MX-909 

Everything you need to build 500 exciting projects! 




$ 159 


Guaranteed Lowest Prices 


SEE US ON THE WEB- 


C&S SALES, INC. 


2 YEAR FACTORY WARRANTY 


JUNE 2004 


39 




Nuts’ & Volts 


Selected Titles for the Electronics Hobbyist and Technician — 

The Nuts & Volts Hobbyist Bookstore 


Robotics 

SUMO BOT 

by Myke Predko / Ben Wirz 

Here’s a fun and 
affordable way for 
hobbyists to take their 
robot building skills to 
the next level and be 
part of the hottest 
new craze in amateur 
robotics: Sumo 
competition. 

Great for ages 1 4+, the kit comes 
complete with: 

• Pre-assembled PCB 

• Multi-function, dual-channel remote 
control 

• Robot hardware, including collision- 
sensing infrared LED and receivers 

• CD-ROM with programming instructions 
and file chapters of robot building tips and 
tricks 

• A built-in Parallax BASIC Stamp 2 and 
prototyping area, allowing hobbyists to 
create their own robot applications 
without having to purchase additional 
Parallax products $99.95 



Robots, Androids, and 
Animatrons, Second Edition 

by John lovine 
In Robots, Androids, and 
Animatrons, Second 
Edition, you get every- 
thing you need to create 
1 2 exciting robotic proj- 
ects using off-the-shelf 
products and workshop- 
built devices, including a 
complete parts list. Also 
ideal for anyone interested in electronic 
and motion control, this cult classic gives 
you the building blocks you need to go 
practically anywhere in robotics. $ 1 9.95 



The Robot Builder’s Bonanza 

by Gordon McComb 

A major revision of the 
bestselling "bible" of 
amateur robotics building 
— packed with the latest in 
servo motor technology, 
microcontrolled robots, 
remote control, LEGO 
Mindstorms Kits, and other 
commercial kits. $24.95 



WE ACCEPT VISA, MC, AMEX, and 
DISCOVER 

Prices do not include shipping and 
may be subject to change. 

Ask about our 10% subscriber 
discount on selected titles. 


40 


Building Robot Drive Trains 

by Dennis Clark / Michael Owings 

This essential title is just — 
what robotics hobbyists 
need to build an effective 
drive train using in 
expensive, off-the-shelf 
parts. Leaving heavy-duty 
“tech speak” behind, the 
authors focus on the actual 
concepts and applications 
necessary to build — and 
understand — these critical force-conveying 
systems. $24.95 

Everything you need to build your 
own robot drive train: 

• The Basics of Robot Locomotion 

• Motor Types: An Overview 

• Using DC Motors 

• Using R/C Servo Motors 

• Using Stepper Motors 

• Motor Mounting 

• Motor Control 

• Electronics Interfacing 

• Wheels and Treads 

• Locomotion for Multipods 

• Glossary of Terms, Tables, and Formulas 




Electrical Engineer's 
Portable Handbook 

by Robert Hickey 

This quick look-up, working 
tool — packed with tables, 
charts, and checklists — 
takes the guess work out 
of almost any electrical 
design task or calculation. 

Indispensable for electrical 
engineers, designers, and 
technicians, the Handbook 
provides immediate 
fingertip access to the 
fundamental information busy professionals 
need for everyday use in the field. $59.95 


Electronics 

Build Your Own Printed 
Circuit Board 

by Al Williams 

With Build Your Own 
Printed Circuit Board, you 
can eliminate or reduce 
your company's reliance 
on outsourcing to board 
houses and cut costs 
significantly. Perfect for 
advanced electronics 
hobbyists as well, this 
easy-to-follow guide is by 
far the most up-to-date source on making 
PCBs. Complete in itself, the handbook 
even gives you PCB CAD software — on 
CD — ready to run on either Windows or 
Linux. (Some PCB software costs from 
$10,000.00 to $15,000.00!) $27.95 



PSpice for Basic Circuit Analysis 

by Joseph Tront 

PSpice for Basic Circuit 
Analysis introduces readers 
to the fundamental uses of 
PSpice in support of basic 
circuit analysis. This book is 
designed so that the reader 
can advance rapidly to 
solve a variety of circuit 
analyses. Although the fun- 
damental capabilities of PSpice are covered 
in this book, the principles can be easily 
extended to analyze the complex electrical 
and electronic networks used in modern 
integrated circuit design today. $24.00 




The Amateur Scientist 2.0 
Science Fair Edition 

from “The Amateur Scientist” column 

This CD contains the 
complete collection — 

73 years — of articles * 
from Scientific American 
Magazine's legendary 
column "The Amateur 
Scientist," plus a second 
Science Software 
Library CD with dozens 
of shareware and free- 
ware programs to feed 
the passion of any science nut. With over 
1 , 1 00 projects to challenge science 
enthusiasts of all ages and skill levels — 
rated by cost, potential hazard, and difficulty 
— this is the ultimate resource for anyone 
interested in home-based science. If that's 
not enough, it also contains over 1 ,000 
bonus pages of additional how-to science 
techniques that never appeared in Scientific 
American. Great for science fair students, 
hobbyists of all ages, and home-schoolers! 
In fact, The Amateur Scientist 2.0 contains a 
special primer for science fair students. 
Fully text-searchable and packaged in an 
attractive double-CD case, this remarkable 
browser-based product runs seamlessly on 
every platform — Windows, Macintosh, 
Linux, and Unix. 

$24.99 — Subscriber 
$29.99 — Non-subscriber 


Encyclopedia of Electronic 
Circuits, Volume Seven 

by Rudy Graf 

Designed for quick 
reference and on-the-job 
use, the Encyclopedia of 
Electronic Circuits, Volume 
Seven, puts over 1 ,000 state- 
of-the-art electronic and 
integrated circuit designs at 
your fingertips.This collection includes the 
latest designs from industry giants, such as 
Advanced Micro Devices, Motorola, 
Teledyne, GE, and others, as well as your 
favorite publications, including Nuts & Volts! 
$39.95 



JUNE 2004 






Call 1-800-783-4624 today! Or 
order online at www.nutsvolts.com 


Anti-HackerTool Kit, 

Second Edition 

by Mike Shema / Brad Johnson 

Get in-depth details 
on the most effective 
security tools and learn 
how to use them with 
this hands-on resource.A 
must have companion to 
the bestselling security 
book Hacking Exposed, 
this tool kit includes tips 
and configuration advice for getting the 
best results from the top hacking tools 
created and in use today. $59.99 



The Audiophile's Project 
Sourcebook: 80 

High-Performance Audio Electronics 
Projects 

by G. Randy Slone 
The Audiophile’s Project 
Sourcebook is devoid of the 
hype, superstition, myths, 
and expensive fanaticism 
often associated with high- 
end audio systems. It pro- 
vides straightforward help in 
building and understanding 
top quality audio electronic 
projects that are based on solid science and 
produce fantastic sound! $29.95 



Electronic Gadgets for 
the Evil Genius 

by Robert lannini 

The do-it-yourself 
hobbyist market — 
particularly in the area 
of electronics — is 
hotter than ever.This 
books gives the “evil 
genius” loads of projects 
to delve into — from an 
ultrasonic microphone 
to a body heat detector, 
all the way to a Star Wars Light Saber. This 
book makes creating these devices fun, 
inexpensive, and easy $24.95 



CNC Robotics 

by GeoffWilliams 

Written by an 
accomplished workshop 
bot designer/builder, 

CNC Robotics gives you 
step-by-step, illustrated 
directions for designing, 
constructing, and testing 
a fully functional CNC 
robot that saves you 
80% of the price of an 
off-the-shelf bot — and can be customized 
to suit your purposes exactly because you 
designed it. $34.95 
JUNE 2004 



Troubleshooting & Repairing 
Consumer Electronics Without a 
Schematic 

by Homer Davidson 

In this book, Homer 
Davidson gives you 
hands-on, illustrated 
guidance on how to 
troubleshoot and repair 
a wide range of electronic 
products — when you 
can’t get your hands on 
the schematic diagrams. 

He shows you how to 
diagnose and solve circuit and mechanical 
problems in car stereos, cassette players, 
CD players, VCRs, TVs andTVA/CR 
combos, DVD players, power supplies, 
remote controls, and more. $34.95 


Microcontrollers 

STAMP 2: Communications and 
Control Projects 
by Thomas Petruzzellis 
With the help of detailed 
schematics, informative 
photos, and an insightful 
CD-ROM, STAMP 2: 

Communications and 
Control Projects leads you 
step-by-step through 24 
communications-specific 
projects. As a result, 
you’ll gain a firm understai 
and its programming methodoTogies — as 
well as the ability to customize it for your 
own needs and operating system. $29.95 




Optoelectronics, Fiber Optics, 
and Laser Cookbook 

by Thomas Petruzzellis 

This is a practical guide 
to one of the hottest 
fields in electronics 
and optical circuits.A 
collection of hands-o 
experiments and 
projects for the student, I 
technician, and hobbyist, f 
it explains optoelectronics I 
in nontechnical terms. I 
Projects show how optical circuits work 
and how to use them in practical and 
efficient ways. You’ll save time, money, and 
energy with dozens of do-it-yourself 
projects — from laser alarm systems to 
high-speed fiberoptic data links. Circuit dia- 
grams, schematics, and complete parts lists 
accompany each project and an appendix 
lists suppliers for needed parts. $29.95 



Schaum's Easy Outline of 
Electric Circuits 

by Mahmood Nahvi / Joseph Edminister 

What could be better than 
the bestselling Schaums 
Outline series? For stu- 
dents looking for a quick, 
nuts and bolts overview, 
there’s no series that does 
it better. Each book is a 
pared-down, simplified, and 
tightly focused version of 
its predecessor. With an 
emphasis on clarity and brevity, these new 
titles feature a streamlined, updated format 
and boil down the absolute essence of the 
subject, presented in a concise and readily 
understandable form. Graphic elements — 
such as sidebars, reader-alert icons, and 
boxed highlights — stress selected points 
from the text, illuminate keys to learning, 
and give students quick pointers to the 
essentials. $8.95 



Hi gh Voltag e 

Homemade Lightning: Creative 
Experiments in Electricity 

by R. A. Ford 

Enter the wide-open 
frontier of high-voltage 
electrostatics with this 
fascinating, experiment- 
filled guide. You'll discover 
how to make your own 
equipment, how electricity 
is used in healing, and 
how experiments in high 
potential physics work! 

$24.95 



Home Entertainment 

Build Your Own Smart Home 

by Anthony Velte 

Wow! If you've got the 
time and inclination, 
there isn't anything that 
cannot be automated in 
your home.This one 
stop resource uses 
clear, step-by-step 
instructions and 
illustrations to show 
you how to plan and 
install smart home systems. Discover 
projects for automating entertainment 
systems, home security systems, utilities, 
and more. $29.99 



If you don’t see what you need 
here, check out our online 
store at www.nutsvolts.com 
for a complete listing of the 
titles available. 


41 










Project 


by Tom Napier 


Thte M&ntW 3 
‘Projects 

Digital Synthesizer . .42 
Enigma Machine .... 48. 
Signal Generator . . . J>3_ 

m 

The Puzzball 
TZat'mg System 

To find oat the- level 
of difficulty for 
eacl i of those, 
projects, turn to 
Tuzzball for 
the answers. 

The seaie is from 
T4-, With four 
f r uzzballs being 
the more difficult 
or adVaneed 
projects. Just look 
for the Tuzzbatts in 
the opening header. 

You’ll also find 
information included 
in each article on 
any special tools 
or skills you’ II 
need to complete 
the project. 

L-et the 

soldering begin! 


42 


Build a Simple 
Digital Synthesizer 

Three Cheap Chips Make a Computer- 
Controlled Synthesizer That Generates 
Accurate Waves up to 1 00 kHz 


T he output frequencies from audio signal 
generators are not always either stable 
or accurately specified. An alternative is 
Direct Digital Synthesis (DDS). This process 
creates the desired output from numerical 
samples and generates any frequency you set 
with crystal accuracy. 

For best results, you need an expensive 
Numerically Controlled Oscillator (NCO) chip, 
a fast digital-to-analog converter (DAC), and a 
low-pass filter. 

Provided you don’t want too high of a 
frequency, you can achieve the same result 
with a $3.00 microcontroller and a $2.00 
DAC. With this approach, the most expensive 
part of the generator is often the device — 
such as a bank of thumb-wheel switches — 
used to set the desired frequency. The DDS 
generator described here eliminates this cost 
by using a computer’s serial port to set the 
output frequency, either from the keyboard or 
from a program. The result is a handy bench 
top signal generator that can also be used as 
part of an automatic test setup. 


Inside a DDS 

DDS works by adding a number to an 
accumulator register at a fixed clock rate. The 
number in the accumulator steadily increases, 
overflows, and starts increasing again. The 
rate of increase and the number of overflows 
per second is a linear function of the number 
being added. The cyclic accumulator value 
can be converted into samples representing a 
sine wave. 

Converting these samples to analog form 
and low-pass filtering the result generates an 
accurate sine wave at the rate of one cycle per 
accumulator overflow. Changing the number 
added to the accumulator in each time interval 
changes the output frequency in proportion. 
Practical output frequencies range from DC to 
about a third of the clock frequency. 

The ratio between the input number and 
the output frequency is a function only of the 
clock frequency and the size of the accumulator. 
These are chosen by the designer to give a 
convenient frequency setting ratio expressed 



JUNE 2004 



Build a Simple Synthesizer 


in Hz per unit. 

A commercial DDS chip might have a 32-bit 
accumulator incremented at up to 70 MHz. With a 42.950 
MHz clock, for example, we could set any output frequency 
from DC to about 14 MHz in steps of 1/100 Hz. Each 
overflow requires a total of 4,294,967,296 to be added to 
the accumulator. If we add some number (N) 42.950 
million times a second, it will take 100/N seconds to 
generate each overflow, thus N sets the frequency in 1/100 
Hz units. If N equals 1,000,000, for instance, the output 
frequency is exactly 10 kHz. This output will be as accurate 
and as stable as the crystal clock driving the NCO. If the 
required frequency is low enough, there will be many 
samples per output cycle. The sine wave generated by 
filtering them will be as good as the number of bits per 
sample allows. A typical NCO chip generates a 12-bit sample 
every 15 nS. This requires a fast and expensive DAC. 

Less Than Perfect 

Provided you don’t want an RF output, you can get 
away with much cheaper components. You can emulate an 
NCO chip in firmware running on a simple PIC16C54 
microcontroller. As each instruction takes at least 200 nS 
and it takes many instructions to implement the accumulator 


and the sine wave conversion, the effective clock frequency 
is quite low. The eight-bit output also limits the purity of the 
output waveform. At low frequencies, it shows distinct 
steps. Despite these limits, a firmware NCO is a useful 
signal generator, even well beyond the audio range. 

I’ve designed several PIC-based NCOs. For this project, 
I decided to go all out for speed, leaving out things 
like phase modulation (Figure 1). I’ve used a 16-bit 
accumulator that limits the scale factor — the smallest 
frequency change you can make — to 5 Hz per unit. On 
the other hand, this generator works to 100 kHz. The 
frequency reference is a 19.6608 MHz crystal driven by the 
PIC’s internal crystal oscillator. Consequently, the scale 
factor may differ from 5.000 Hz by a few hundred parts per 
million. If you have a calibration frequency source, you can 
tune the crystal by using a 30 pF trimmer for capacitor C4. 
The alternative is to use an accurate 19.6608 MHz crystal 
oscillator. 

Fancy Firmware 

Once things have been initialized, the firmware runs 
continuously around a 15 instruction period loop, generating 
a sine sample each time around. The loop executes 
327,680 times a second, so that is the effective NCO clock 


Parts List Software 


for 'Engineers and ^Designers 


■ Easily create and manage multi-level parts lists for 
products in development.. .and after. 

■ Track sources for items with multiple price breaks. 

■ Calculate product costs at any quantity. 

■ Launch CAD, viewer or browser from any Item. 

■ Automatically generate RFQs or POs. 



New Version 5.0 

■ New Report Layout Editor 
customizes reports/labels. 

■ New Connection to 
QuickBooks 2002/2003 Pro 
simplifies accounting ius 

version only). 

■ New Multi-currency for 
foreign suppliers eases 
exchange rate calculations. 


Visit www.trilogyclesign.com 
and download our free demo. 


Parts 

Vendors 


For Windows 
98/NT/Me/2K/XP 
3 Editions, 
starting at 
$99 + s/h 



Or, Call 800-280-5176 

530-273-1985 Fax 530-477-9106 
P.0. Box 2270, Grass Valley, CA 95945 



43 


JUNE 2004 



NQtT& Volts 


Project 



frequency. The 16-bit accumulator overflows every 
65,536 units; that’s where the scale factor of 5 Hz per unit 
comes from. 

Each loop adds a user selected, 16-bit number to the 
accumulator. Changing the number being added changes 
the output frequency. The upper byte of the accumulator 



44 


is converted into a sample from a sine wave and sent to 
the PIC’s eight-bit port. Once in every loop, the program 
checks for a user input. The sine conversion uses a 
256 byte look up table. Each table entry is a RETLW 
instruction that specifies the number to be placed in the 
W register during the return. In previous NCO designs, 
I’ve used a 65-entry, one-quadrant table. To generate a 
full sine wave, the program either reversed the index or 
inverted the output sample. Here, to speed up the loop, 
I’ve used a full 256 byte table. This creates complications, 
as only the first 256 instructions of the PIC’s 512- 
instruction memory can be accessed either by a CALL 
instruction or by an indexed jump. 

To make the program work, I’ve taken advantage of 
several oddities of the PIC16C54’s behavior. When the 
program starts, the first instruction executed is the one at 
address 1FFH. 

Normally, you can ignore this; the PIC executes the 
NOP at that address, then rolls over to address 0. (I once 
got into big trouble by putting a data byte in the last 
program location. Some chips powered up with non-zero 
return stack contents and wouldn’t run.) Here, we use this 
feature to direct the program start-up to the beginning of 
the second instruction block. 

Another 16C54 oddity is its two-level return address 
stack. When a return instruction pops an address, the 
upper stack level contents are copied into the lower level. 
This means that, once a return address has been stored 
in the upper level of the stack, you can pop it as many 
times as you like and you’ll always get the same address. 
This won’t work on the more advanced PIC chips and, if 
you run this code on a PIC emulator program, it will 
generate a stack underflow warning. 

Loops, Fast and Slow 

Here’s how we take advantage of this feature. First, 
let’s write a conventional program containing a table look 
up and a jump to restart the loop: 

The data table actually starts 
at address 0 and contains the sine 
samples SINO and SIN1 to 
SIN255. Ignore the stuff which 
does the real work and look at just 
the to-and-fro instructions. We 
have a CALL, an indexed jump 
(MOVWF PC), a RETLW, and finally 
a GOTO that restarts the loop. 

Each takes two instruction periods 
or a total of eight periods. Can we 
improve on this? Suppose the 
address of LOOP has been copied twice to the 
return stack. Now, every time we execute a RETLW 
instruction with no prior CALL, we get both a sine sample 
and a free ride back to the start of the loop. With a minor 
JUNE 2004 


LOOP: 

Test serial port 
Step accumulator 
Fetch upper byte 
CALL JUMP 
Sample to port 
GOTO LOOP 

JUMP: 

MOVWF PC 



RETLW SINO 
RETLW SIN1 




Build a Simple Synthesizer 


rearrangement we can write: 


LOOP: 

Sample to port 
Test serial port 
Step accumulator 


By making an indexed jump 
into the data table with no prior 
CALL instruction, we force the use 
of the pre-existing return address, 
i.e., that of the start of the loop. 

The table look up and the loop TABLE: 
restart are combined, leaving only retlw sini 

a indexed jump and a RETLW. and so on 

That’s four instruction periods as 

compared to eight in the earlier version — a significant 
increase in speed. 


Getting There From Here 


How do we write those two return addresses to the 
stack? This can only be done by executing two CALLs. The 
first must be in the right place — immediately before the 
start of the loop. The second, being the destination of the 
first, must lie in the first 256 instruction block. As all of that 
block is required for the look up table, it’s time for a 
work-around. 

Suppose we put the second CALL at address 0. 
Whenever the table index is zero — an easy number to 
detect — we bypass the look up and generate sample SINO 
directly. The DAC input scale goes from 0 to 255, so SINO 
is 128. We put CALL 1 at location 0. 

Watch what happens when we start the program. After 
setting port directions and initializing registers, the 
program executes the first CALL. That puts the loop 
address into the first stack level; execution continues with 
the CALL at address 0. That CALL pushes address 1 onto 
the stack, but also moves the loop address to the second 
stack level, where it will remain for ever after. 

Doing CALL 1 takes us to the first entry in the look up 
table, which is RETLW SINI. (The value of SINI is 
immaterial.) That returns us to address 1, so we execute 
RETLW SINI a second time. This time, the original loop 
return address has been copied down the stack, so we 
start executing the loop. From that point on, everything 
works normally. The final loop is: 

LOOP: 


Execution normally proceeds 
via the indexed jump, MOVWF PC, 
and the look up table. In the special 
case of a zero index, sample 128 is 
inserted and the loop is restarted 
with GOTO LOOP. Both procedures 
take 15 instruction periods to 
complete a loop. 

Setting the 
Frequency 

When the oscillator is turned on, 


MOVWF PORTB 
BTFSC PORTA, SER 
GOTO NEW 

MOVF FREQL, 0 
ADDWF PHASL, 1 
SKPNC 

INCF PHASH, 1 
MOVF FREQH.O 
ADDWF PHASH, 1 
MOVF PHASH, 0 
SKPZ 

MOVWF PC 

MOVLW 128 
GOTO LOOP 


JUNE 2004 


Be an FCC 
LICENSED 


ELECTRONIC TECHNICIAN 



You can earn more money 
if you get an FCC License! 


Not satisfied with your present income? 
Add prestige and earning power to your 
electronics career by getting your FCC 
Government License. 

The Original Home-Study course pre- 
pares you for the "FCC Commercial 
Radiotelephone License" at home in your 
spare time. 

This valuable license is your professional 
"ticket" to thousands of exciting jobs in: 
Communications, Radio-TV, Microwave, 
Maritime, Radar, Avionics & more. ..you 
can even start your own business! 

No need to quit your job or go to school. 
This proven "self-stuay" course is easy, 
fast and low cost! 


GUARANTEED TO PASS - You get your 
FCC License or your money will be refunded. 


Call for FREE facts now! 

( 800 ) 932-4268 

www.Li<enseTrqining.<om 

| ~COMMAN D~ PRODUCTION S~ ~ ~ ~ 0 ~~~ii~ ~ ] 

| FCC LICENSE TRAINING - Dept. 220 <oup 0 „ ! 

I P.O. Box 3000 • Sausalito, CA 94966 today 1 

j Please rush FREE details immediately! J 

| Name | 

J Address J 

I City State Zip I 




NufS&VOLTS 


Project 


it is set to 10 kHz. While generating an output, it is also 
checking the serial input for a start bit. If it detects one, it 
stops generating an output and starts looking for ASCII 
characters at 9,600 baud. “NEW” in the code above is the 
routine which reads, translates, and stores the user’s new 
frequency setting value. 

This code could be easily changed to suit a higher 
serial data rate. The input circuit accepts either TTL or 
RS-232 signal levels. The first character must be a colon. 
The next five characters are your output frequency in 
Hertz, with the most significant digit first. Any additional 
characters are ignored. 

For lower frequencies, use leading zeros, e.g., enter 
:00100 to specify 100 Hz. The least significant digit 
is rounded to the nearest 5 Hz, :00102 will still generate 
100 Hz. 

As the PIC can only do one thing at once, any serial 
input interrupts the output signal. Even a non-colon 
character will cause a millisecond blip in the output. 
Sending a colon turns the output off. You can turn the 
original frequency back on by sending a non-numerical 
character — even a second colon. Entering a new frequency 
at 9,600 baud generates zero output for some 6 mS 
before the new frequency starts. This generator is better at 
generating test tones than sweet music! 



Analog Matters 

The eight-bit samples from the PIC Port B are turned 
into an analog current by a cheap and readily available 
16-pin DAC. This was originally known as the PMI D AC-08, 
but is now more commonly found as the National 
DAC0800. It splits a reference current into two outputs that 
range from 0 to 2 mA and 2 mA to 0, respectively, as the 
digital input varies from 0 to 255. One output makes a 
handy test point. The other is offset to be balanced about 
0 volts and drives the low-pass filter. Trimmer VR2 sets the 
mean voltage to exactly zero. 

The nominal output amplitude is 4 V pk-pk. The figure 
shows a pot (VR1) to set the output amplitude by 
changing the reference voltage. If a fixed output is 
acceptable, VR1 can be omitted. You can achieve 
amplitude modulation by driving CI3b from a 0-5 V signal 
source. A TTL input here keys the output on and off. 

A Fix-up Filter 

The raw DAC output consists of rectangular steps and 
so contains a wide range of frequencies. Only two really 
matter. One is the output frequency itself (fo) and the 
other is the lowest image frequency at (clock-fo). As the 
clock is 328 kHz, this unwanted frequency can be as low 
as 228 kHz. At audio frequencies, the image is close to the 
clock frequency and can be ignored. At frequencies closer 
to 100 kHz, we need an output filter that will pass the 
signal but greatly reduce the amplitude of the image. 

A three-pole active filter works adequately and is a lot 
less expensive than an LC filter, whose millihenry inductors 
would cost more than the chips. The finite width of the 
output samples causes a natural roll-off in the output 
amplitude, some -1.4 dB at 100 kHz. The filter response 
peaks a little to compensate. For proper filter operation, 
the buffer amplifiers should be much faster than the signal. 
A transition frequency of 4 MHz is about as low as one can 
go. Their slew rate and high frequency output swing also 
limit how fast and how big of an output you can have. I’ve 
tried several amplifiers and found that the TL082 gives 
good results. The output — with its 100 ohm safety resistor 
— can drive a 50 ohm load at a reduced amplitude. 

The DAC and output amplifier run from ±12 V. On my 
computer, this is provided by the serial port; users of other 
computers must make their own arrangements. The 78L05 
regulator provides +5 V power to the PIC and the DAC 
reference voltage. If a stable +5 V supply is available, the 
78L05 can be deleted. In a pinch, you can run the board 
from +-5 V, but the maximum output swing will be reduced. 

The 16C54 must be programmed with the code 
PICNCO.OBJ, which is available from the Nuts & Volts 
website’s FTP library (www.nutsvolts.com) . If you plan 
on never reusing the microcontroller, you can save several 
dollars by buying a one time programmable chip rather 
than the CIV erasable one. NV 


46 


JUNE 2004 





Moreinfo? 


serviced by 


This is a built up Theremin fr 
Theremin is a weird musical 
invented early last century bi 
The Beach Boys hit: "Good 
the Theremin. You can have one of these kits 
(cat no. KC-5295) for $25.90. All kits have first 
class instructions written in clear English text with 
plenty of illustrations and component identification. 


www.jaycarelectromcs.com 

1800 784 0263 


jnycnr 


(Monday - Friday 09.00 to 17.30 GMT + 10 hours only) 
For those that want to write: 

100 Silverwater Rd Silverwater NSW 2128 Australia 


No, not at all! 

The hobby electronics market in Australia has been historically very strong with large numbers of 
dynamic electronic magazines and vigorous commercial suppliers. 

The most dominant company in this "Down Under" market, Jaycar Electronics, is now in a position to offer 
of products to a wider audience, thanks to the Internet. 


Concerned about dealing on the Internet? 

Well, you should be. At the same time, the amount of legitimate 

fraudulent trade by millions and millions to one. World internet trade today easily exceeds the 
Gross National Product of many large countries! 

Jaycar has been doing business on the Internet now for over 10 years. The thousands of happy 
repeat customers on our files is a testimony to how safe it can be when you deal with a 
WWWj aMCareieClro niCS.com reliable supplier like us. Worried about freight costs? NO NEED with our great rates. 


New 2004 Catalog - all 424 pages 

We have a brand new catalog priced in US Dollars crammed with over 
6000 exciting products. You can get one FREE by logging on to our website 
and filling out the catalog request form atj« 

(Offer valid till October 2004). 


We Stock: 

• A huge range of exciting kits 

• A great range of robotic components 

• The best range of electronic components 

• The largest single-source range of gadgets 

• Security, Surveillance, Audio/Video, Lighting, Computer & Telecoms Parts etc. 


Check our website! 

• Entire Jaycar 2004 Catalog on-line - over 6000 products. 

• 128-bit Secure on-line ordering - safe & secure. 

• Express ordering. 

• Search by category, keyword or catalog number, & advanced search. 

• Over 3500 product datasheets & application notes available on-line. 





siioai siON 


Project 


by Gerard Fonte 


TT 


Mr. E. MacHine: 

The Enigma Machine 

Lightning in the Palm ofYour Hand — Safely! 


T his is one of those things that seems just a little 
interesting at the start, but, as you look closer, it gets 
stranger and stranger. It’s a simple, plain, plastic box. 
It has a knob, LED, and power connector. When you turn it 
on, it doesn’t seem to do anything at all. It just sits there. 
However, put an empty soda can on the machine and 
lightly rub it with a dry finger. The can vibrates. Yet, this 
does not happen with a stationary finger or a damp finger. 
Now, put your hand on the plastic box and hold the soda 
can in your other hand. Have someone else brush the can 
with a dry finger. Surprise! They feel the can vibrate. 
Something is passing through the plastic box, through you, 



through the can, and into the other person. It turns out that 
this and other effects are not well documented. In fact, some 
of these effects appear to be completely unpublished. A 
great deal of research was necessary to get this information. 

This is the first of four parts. Here, we’ll look at the 
hardware. We’ll see that the Enigma Machine generates a 
high voltage pulse (about 1,200 volts) that is insulated 
and isolated so that virtually no current flows. This allows 
us to play with high voltage safely. This article presents 
two versions of the machine. The first is a “project” 
version. The second is a “product” version. (For a 
discussion of the difference, see my “In the Trenches” 
article in the January 2003 issue of Nuts & Volts.) 

The second and third parts will present experiments 
you can do, as well as explain the basic physics behind 
the experiments. In the last part, we will examine the 
related fringe science topics. We’ll look at Kirlian 
photography and the life “aura” associated with it. 
Additionally, we’ll see reasonable answers to some of their 
strange claims. We’ll also look at ELF (Extremely Low 
Frequency) and other health-related effects. Finally, we’ll 
touch on some leading edge research. 

Mr. E. MacHine 

Let’s look at Figure 1 . This is the schematic diagram 
for the project. Actually, this was the prototype design 
and was used for proof of concept tests. The basic 
core of the system is a 555 timer (CI1) that is wired as 
a free-running multivibrator (also known as an oscillator). 
It produces a rectangular output on pin 3. The 
frequency of operation is about 10 to 500 Hz, depending 
on the setting of Rl. The basic circuit (CI1, Rl, R2, C2, 
and C4) is the common configuration found in all the 
data books. Capacitors C5 and Cl stabilize the power 
supply to the device. Resistor R4 plays a vital role in 
this as well, but we’ll discuss it later. 

The output from CJ1 goes to a switching circuit 
composed of R3, R5, C3, Dl, and Ql. The basic idea is 
to have the transistor turn on only for a very short time. 
The output of the 555 stays high for too long. So, we 
AC couple it through C3. This creates a positive pulse 
on the rising edge of the 555 output and a negative 
pulse on the falling edge. Since we don’t want a 
JUNE 2004 



The Enigma Machine 


negative pulse going into Ql, the 
diode (Dl) is used to steer that to 
ground. The width of the positive pulse 
is controlled by the R/C network of C3 
and R5. These are chosen to turn on 
Ql for about 100 pS. Resistor R3 is 
used to limit the drive current. Too 
much current causes Ql to oscillate 
and waste energy. The transformer is 
the major player of the circuit. It 
converts 12 volts to about 1,200 volts. 
I looked around at various flyback and 
other types of transformers and settled 
on a 12 volt automobile ignition coil 
because they were readily available 
and generally less expensive. 

We now see that the circuit is really 
quite simple. It generates a pulse that 
turns on an electrical switch that lets 
the full battery current flow through 
the step-up transformer. However, at 
first, it didn’t work very well. It turned 
out that when the switch (Ql) was 
turned on, the battery voltage sagged 
and the 555 timer didn’t work properly. 
This is where R4 comes in. It isolates 
dl power from the battery terminal 
voltage. The resistor forms an RC 
network with C5 (and to a much 
lesser extent Cl). This limits current 


itt, 5% ) 

I OK potentiometer 


OUT of C5 when the battery voltage 
sags. This added resistor made the 
circuit operate as desired. 

But Why Doesn’t Ql 
Burn Out? 

There is no current limiting resistor. 
Full power goes through the 1 Q 
primary winding of T1 to the collector of 
the transistor and then directly to 
ground and there’s no inductive 
kick-back protection diode either! Won’t 
this circuit fail? Actually, the circuit is 
operating well within specifications. 
Remember the pulse is only 100 pS 
long. This makes the AC resistance 
(reactance) of the coil much higher. In 
fact, careful current measurements 
show that the current through the coil has 
a maximum value of between 300 and 
400 mA (depending on pulse rate and 
battery voltage). These measurements 
were made using a 3 amp power supply 
instead of batteries. The transistor is 
rated at 500 mA of continuous current 


R4 


100 


Capacitors (25 volts) 

CI.C2C3 0.1 pF 

04 10 pF 

C5 100 pF 

T I 12 volt automobile ignition coil 

(generic, see text) 

Q I 2N2222 transistor (see text) 
Dl I N9 14 diode 

Ul 555 timer 1C 

SWI SPST power switch 

B I 12 volt battery 

Misc. Plastic case, 3” x 5” x 7” 

(RadioShack P/N 270-1807 
includes metal plate) 

Metal plate for top of case 
Aluminum foil 
Knob for R I 
Battery holder 
PC prototyping board 
Wire, solder, etc. 


Parts List for Figure 2 Schematic 

Resistors 

fl/4 watt. 5% unless specified! 

R 1 , R6, R7 

IK 

R2 

IM 

R3 

1 OK potentiometer with switch 
(Mouser 3 ICQ40I) 

R4 

2K 1% 

R5 

I0K 1% 

Capacitors (50 volts) 

Cl 

100 pF 

C2-C4 

0.1 pF 

Everythin 

g Else 

Ql 

2N2222 transistor (see text) 

Dl 

1 N9 1 4 diode (optional, see text) 

D2 

Red LED (see text) 

Ul 

PICI6F675 9-pin flash 
microcontroller 

U2 

78L05 low-power 5 volt 
regulator 

U3 

Bridge rectifier 

Tl 

1 2 volt automobile ignition coil 
(generic, see text) 

SWI 

SPST power switch (part of R3) 

Jl 

Misc. 

2. 1 mm power jack 
(jameco I5I589CA) 

Plastic case 

s 3” X 5” X 7” (RadioShack 270-1807 

includes metal plate), 9 volt to 12 volt AC 

adapter (see text), metal plate for top of case, 

aluminum foil, knob for R3, PC prototyping 

board, wire, solder, etc. 


wwwJynxmotion.corn 



Robotic Arm Five DOF Arm 


Sumo' Robot Rugged Design 



We have many more unique 
robot kits. Our robots feature: 

• Precision Laser-Cut Lexan 

• Preassembled Electronics 

• Custom Aluminum Components 

• Injection Molded Components 

• Very High Coolness Factor 

Toll Free: 866-512-1024 
Web: www.lynxmotion.com 

49 



JUNE 2004 





NufS&VOLTS 


Project 



and, in this application, the current is not continuous. 

At the maximum pulse rate of 500 Hz and pulse width of 
100 |iS, the actual “on” time of the transistor is only 5% (50 
mS per second). Thus, the average current is only 5% of the 
maximum — 15 to 20 mA. The result is that Q1 doesn’t even 
get warm. Careful measurements also showed that the 
inductive kick-back was minimal. There was only a 50% 
increase over supply voltage. So, for a 12 volt supply, the 
kick-back was only 18 volts. The reverse breakdown voltage 
for the 2N2222 is 30 volts. The 2N2222A version has a 40 
volt breakdown voltage. It is important that this switching 
circuit be built as shown. Different transistors have different 
ratings and different operating characteristics. Different 
resistors and capacitors will cause different pulse widths and 
different currents into the transistor. Unless you know 
precisely the effect a change will make, don’t do it. Safety 
first! While low current, 1,200 volt pulses are probably not 
dangerous, it’s not a good idea to take chances. (Note: D1 
can be any small signal or low-voltage rectifier diode as long 
as the forward voltage drop is 0.7 volts or less.) 

The Output Plate 

The output plate is just some aluminum foil taped to 
the inside of the plastic cover. (See Figure 5). This 
isolates the electrical path to ground because the cover is 
plastic. Since there is no path to ground, no current can 
flow. This makes experimenting with the high voltage safe. 
(We’ll look at measuring the real current in a later article.) 

The Benefits of a jiC 

Figure 2 shows the schematic diagram of the product 
version of the Enigma Machine. Let’s look at the differences 
and why they were made. The first and most obvious change 
is that U1 goes from being a 555 timer to a PIC 12F675 flash 
microprocessor (pC). At first, this seems wrong. The |lC 
costs about $1.25 while the 555 costs about $0.25. We’ve 
increased costs by about $1.00, but it buys a huge amount 
of flexibility, reliability, safety, and additional features. It turns 
out that this $1.00 is a very good investment. 

The benefits of the pC start with the output pulse. 

50 


Instead of converting an edge to a 100 pS 
pulse, we can directly create one. What’s more, 
our pC pulse is not dependent on external 
capacitors. Instead, the internal pC clock is 
used. That gives us a pulse-width variation of 
only 2% from unit to unit. (With the 555 timer, 
the variation in capacitor values is typically 10 
to 20%.) It also improves reliability. The timer 
version wouldn’t work with EXAR manufactured 
555 timers (because of R4). It’s never good to 
need or avoid “the same” parts from specific 
manufacturers. The analog-to-digital (A/D) 
converter on the pC allows us to measure the 
supply voltage and determine if it is appropriate. 
If the voltage is incorrect, the pC can shut down the system. 
This significantly increases safety and, lastly, the pC can 
control an LED and make it flash if something is wrong. 

How the \lC Version Works 

There are a number of circuit changes between the project 
version in Figure 1 and the pC product version shown in the 
Figure 2 schematic diagram. Let’s look at the power supply 
first. Instead of a battery, we have a power jack. This can 
connect to either an external battery or an AC adapter. 

I always get annoyed because I never have the right 
adapter. I figured others did, too. The addition of CJ3 — a 
bridge rectifier — allows the use of any polarity adapter. 
Even AC can be used. The pC requires 5 volts. Since this is 
also the reference for the A/D, it has to be regulated. Thus, 
the need for CJ2. It’s a low power, three-terminal, 5 volt 
regulator. Capacitors Cl and C2 stabilize the input voltage 
and are especially needed if AC is used (to reduce ripple). 

The pC reads the voltage across R3 to determine the 
pulse rate. It can vary from 7.8 Hz to 256 Hz, according 
to the setting. The switch on R3 is used to turn the unit on 
and off. Another channel of the A/D reads a portion of 
the actual input voltage through the voltage divider made 
up of R4 and R5. This presents 1 /6 of the input voltage to 
the A/D. Since the pC is operating at 5 volts, this limits 
our input voltage to 30 volts. Anything more than 30 volts 
will present more than 5 volts to the pC pin. It isn’t good 
to have pin voltages greater than the supply voltage. 

Resistor R6 limits the current to the LED. The software 
controls how the LED lights. A steady glow indicates 
everything is okay. A slowly flashing LED (about 1 Hz), 
says that the input voltage is too low. A rapidly flashing 
LED (about 5 Hz) says the input voltage is too high. If the 
input voltage is either too high or too low, the pC doesn’t 
send any pulses to the switch, so no high voltage is created. 

There is also a special function for this LED. It’s used as 
a voltage reference. It turns out that, as the supply voltage is 
reduced below 7 volts, CI2 fails to regulate and the voltage to 
the pC drops. This means that the A/D reference drops, as 
well. This causes problems in determining the actual supply 
voltage, but, since the voltage across a red LED is constant, 
JUNE 2004 




The Enigma Machine 


this can be used as a reference. (Different colored LEDs have 
different forward voltages. A red LED is required here.) This 
LED voltage is fed back into an A/D pin on the pC. If this 
voltage appears to rise in relation to the internal Vcc voltage, 
then it really shows that the internal Vcc voltage is dropping. 
This, in turn, means that U2 is no longer regulating properly. 
The software will then act appropriately by flashing the LED 
slowly. The switch circuit looks very similar to the 555 
version, but there are a number of differences. 

Capacitor C3 is for safety rather than pulse shaping. It 
prevents the transistor from being turned on and kept on if 
there is a hardware or software malfunction on pin 2. Clearly, 
if Q1 is turned on and kept on, it will burn out. 

Safety also works in the other direction. If Q1 shorts 
out, then the full supply voltage flows through the base of 
the transistor. Without C3, that voltage would enter Cl 1 and 
destroy it. R1 helps in this failure mode, as well, by limiting 
the current. Resistor R2 is increased to 1M from IK. This is 
because it is no longer used to form an R/C network. 
Rather, it keeps Q1 turned off in the absence of any pulse. 
Otherwise, the base could float and be susceptible to noise. 

Software 

The software is trivial. Functionally, it operates as follows: 


Use the A/D to read the LED voltage and supply 
voltage and determine actual supply voltage. If the supply 
voltage is too high, flash the LED once quickly and go to 
1. If the supply voltage is too low, flash the LED once 
slowly and go to 1. Use the A/D to read the setting of R3 
and determine the pulse rate. Send out a 100 pS pulse and 
wait, depending on rate. Then, go to 1 . 

The source code is available on the Nuts & Volts 
website’s FTP library (www.nutsvolts.com) , but it’s so 
simple you should do it yourself for practice. 

Assembly Instructions 

It is strongly recommended that the specified case be 
used (RadioShack P/N 270-1807). It is the proper size and 
includes a metal cover that we will use as the metal plate 
for later experiments. Remember, whichever case you use, 
the “output plate” is just aluminum foil attached to the 
inside of the plastic cover. The only electrical connections 
that pass through the case are the power connections. 

Concerning the layout and construction of the prototype 
“product” circuit, there are a few special notes. A standard 
pad-per-hole prototype board is used and cut to size (2.6” by 
1.4”). Standard point-to-point wiring was used. Resistor R3 
(the 10K pot) is mounted from behind, so that the solder 







siiOAJSinN 


Project 



terminals are flush with the board and they are soldered to 
the pads. The LED and power jack are mounted on the 
same center line with the LED center, 1.850” from R3 center, 
and the power jack opening center, 1.500” from R3 center. 

The power jack sits lower than the pot. To compensate 
for this, you can use the printed circuit board (PCB) slots 
extending from the side of the case as a 0.050” spacer, if 
you like. If you do, the pot will align between another 
pair of slots. There are height considerations for the 
components because the PCB is mounted to the case with 
the nuts for R3 and the power jack. The board to case 
spacing is 0.175” maximum. This means Cl must be 
mounted on the back of the board. Also, an ordinary socket 
cannot be used for Cll (the pC) — with the chip inserted, 
it’s too tall. You could solder Cll directly in place or you 
can make your own socket, like I did, by using separate 
socket-pins and reaming out the holes so they sit lower. 

Figure 3 shows the completed electronics. You can 
more easily see that the power jack is the back-mounting 
type with a nut that goes through the panel. Discrete wires 
connect the coil to the PCB. My coil had quick-connect 
contacts. Yours may have screw connections. There is a 
bare wire coming from the high voltage output of the coil. 
The electrical contact there is usually held in place with a 
screw. Just unscrew it, put a loop of bare wire (1 used 24 
gage) around the screw, and screw it back into place. 

In Figure 4, you can see the start of the mechanical 


Enigma Safety Notice 

1 . This article deals with high voltage and high voltage effects. When built 
and used as described, it is felt to be completely safe. Improper use and 
construction can cause electrical shock. 

2. Several experiments demonstrate effects that pass through the body of 
the user. Therefore, it is not recommended that anyone with a pacemaker 
or other embedded electrical device participate in these experiments, nor 
should it be used in very close proximity to any electrical equipment where 
electromagnetic interference could cause safety concerns. 

3. Several experiments have shown subtle biological effects on plants after 
continuous exposure of days to weeks. 


52 


assembly. The PCB is mounted to the side 
of the case, with the mounting hardware 
for R3 and the power jack. Notice the 
PCB slots and mounting of Cl on the 
back of the PCB. A piece of white plastic 
foam (the type formerly called 
styrofoam) is wedged between the base 
of the coil and the case. More plastic 
foam holds the coil in place. Additional 
foam holds the coil in place. You could 
use a plastic clamp or strap. Don’t use 
metal because it could cause an 
exposed ground and current could flow. 
I liked the foam because no additional 
case work was required. You can also 
see R3, LED, and power jack details. 
Figure 5 shows the last piece of 
foam that holds everything in place. If you look closely, 
you can see the high voltage wire that comes up from the 
left side and runs over the top of the foam. I pushed the 
free end of the wire into the foam to hold it in down. This 
wire makes physical contact with the aluminum foil “output 
plate” that is taped to the inside of the plastic cover. I used 
a couple of strips of double-sided cellophane tape and 
ordinary aluminum foil. The final product’s graphic overlay 
is color printer artwork with clear, 2” wide cellophane tape 
over the top for protection. It’s attached to the case with 
more double-sided cellophane tape. 

Finally, Figure 6 shows the high voltage output (hori- 
zontal is 100 pS per major division). It’s a textbook exam- 
ple of a ringing inductor. Peak voltage is about 1 ,200 volts. 

Troubleshooting 

First, verify you are getting a pulse out (either from the 
555 or jiC). If not, check the power, wiring, or software. If 
you are getting a pulse, you can verify the high voltage by 
connecting a small neon lamp from the high voltage output to 
ground. It should blink at the pulse rate. You can also bring 
an oscilloscope lead near the high voltage output terminal. 
You should see a ringing signal with the probe about 1/2” 
away. If you are getting pulses out and no high voltage, the 
problem is isolated to the switching circuit or Tl. 

Mr. E. MacHine 

That’s all for this month. I was planning to have kits 
and assembled units available through a third party. 
Unfortunately, that didn’t work out. If there is a reasonable 
demand for kits (at about $50.00) or assembled units 
(about $80.00), I’ll see what I can do about providing them 
myself. (If you want to distribute them, let me know.) 

Mr. E. MacHine, by the way, is pronounced, “Mystery 
Machine.” Capitalizing that one letter really changes our 
perception of the word. It’s interesting that women are 
generally much faster at catching the joke than men. NV 
JUNE 2004 



by Paul Florian 


Project 


An Analog Sine Wave 
Signal Generator 

No Project Bench Should Be Without One! 


A sine wave signal generator can be used to 
measure the frequency response of filters and 
amplifiers. Simply connect the signal generator 
to the input of the circuit under test and adjust the output 
of the generator to an appropriate amplitude. Next, 
measure the output voltage of the circuit at various 
frequencies with an oscilloscope. A frequency response 
graph can then be plotted with this data. 

A sine wave signal generator can also be used to tune 
active or passive filters. The generator is connected to 
the input of the filter and the output is observed on an 
oscilloscope. For example, to set the corner (-3 dB) 
frequency of a lowpass filter, adjust the sine wave 
generator to the desired corner frequency and tune the 
circuit until the output voltage is 0.707 multiplied by the 
input voltage. Similar techniques can be used when tuning 
highpass bandpass, band reject, and notch filters. 
Furthermore, FM signals can be produced by using the 
output of the sine wave generator as a modulation source 
for a VCO (Voltage Controlled Oscillator). 

The circuit in Figure 1 is a schematic of such a generator. 
The heart of the circuit is 
the ICL8038 precision 
waveform generator chip. 

One of two tuning frequency 
ranges is set by S2. The 
first is Low Frequency (10 
Hz to 1,000 Hz) and the 
second is High Frequency 
(1,000 Hz to 100 kHz). An 
oscilloscope or frequency 
counter is needed to set the 
output frequency and an 
oscilloscope is needed to 
measure output amplitude. 

The amplitude control (R6) 
sets the output from 0 Vpp 
to 10 Vpp, while the coarse 
and fine controls set the 
operating frequency. 


the circuit consists of +12 VDC and -12 VDC linear 
regulators. When SI is closed, D3 rectifies the positive half 
of the 19 VAC and is filtered by C3. This produces about 
30 VDC at U3’s input. The CJ3 regulator provides +12 VDC 
at its output. During the negative portion of the 19 VAC, C6 
charges to -30 VDC and the output of U4 is -12 VDC. 

As mentioned earlier, the ICL8038 (01) is a precision 
sine wave generator. Its operating frequency is determined 
by resistors R1-R4 and C1-C2. The Coarse (R2) and Fine 
(Rl) controls determine the output frequency for a given 
oscillator capacitor (Cl or C2). When Cl is selected by S2, 
the output frequency can be adjusted from 1,000 Hz to 
100 kHz. If C2 is selected by S2, the output frequency is 
variable from 10 Hz to 1,000 Hz. If available, 1% tolerance 
capacitors should be used for Cl and C2. If 5% or 10% 
tolerance devices are used, you may have to experiment 
with different capacitors to obtain the appropriate output 
frequencies. 

CI2B has a gain determined by R5 and R6. The maximum 
amplitude of 10 Vpp occurs when R6 is set at 10K. This 
allows the output at CI2B to be adjusted anywhere from 0 


Description 

The power supply to 
JUNE 2004 




NutS&VOLTS 


Project 



Vpp to 10 Vpp. U2A is a buffer that drives the output stage 
formed by Q1 to Q4. The output at J1 is a sine wave of the 
same amplitude and frequency at U2A pin 3. In addition, 
Q3, Q4, R9, and RIO provide output current limiting of 
±100 mA. This will protect the output transistors if there is 
a short circuit condition. 

Construction 

Obtain a PCB with dimensions that are 3x4 inches. 
After the PCB holes are drilled, use Figure 2 to locate 
component placement. Solder jumper wires JP1 
and JP2. Next, solder the IC sockets for U1 and CJ2, 
being careful to note correct orientation. Make four 
three-pin sip sockets from the breakaway sip stick 
and solder them in the holes of Q1-Q4. Solder the diodes 


and resistors. 

Finally solder U3, 04, and capacitors (note that Cl 
and C2 are axial leaded capacitors installed vertically). 
Attach the heatsinks to U3 and 04. You may download the 
PCB pattern from the FTP library on the Nuts & Volts 
website (www.nutsvolts.com) and cut it out. Then center 
and tape it to the bottom of the case. Mark the location of 
the four mounting holes with a punch and drill 1/8 inch 
diameter holes. Center and mark the location of the 
mounting holes for S2, R2, Rl, R6, and J1 on the 
front panel and drill appropriately sized holes. The 
potentiometer holes should be spaced a minimum of one 
inch on centers. Also make a hole for J2 on the reverse 
side of the case. 

Mount the switch SI on R6. The following connections 
each use 6 to 8 inch lengths of wire. Solder a wire from J2 
to one of the AC pads on the circuit board (refer to Figure 
2). Another wire from J2 is soldered to one terminal of 
switch SI and the other side of switch SI connects to 
the remaining AC pad on the PCB. Cut 1-3/8 inch of 
shaft length from R2 and R6. Break off the keying posts of 
R2 and R6 with pliers. Examine Figure 3 for the 
potentiometer designations. 

The pin numbers for Rl are marked on its case (Rl is 
a 10 turn potentiometer). Connect Rl-3 to R2-C. Then, 
connect Rl-2 and R2-R to the appropriate pads on the 
PCB. Wire R6-L and R6-C to the PCB. Connect S2-A, S2-B, 
and S2-C from S2 to the circuit board. Check Figure 4 for 
switch terminal assignments. Attach two wires to J1 and 
mount in the case. Solder the ground wire of J 1 to the Gnd 
pad on the PCB and connect the center conductor of J 1 to 
the pad marked Fout. 

Now, mount Rl, R2, R6, S2, and J2 to the case. The 
notch on S2 should face down. 
Attach the knobs on R2 and R6. 

Testing 

Verify that 01, 02, and Q1-Q4 
are not installed. Plug in the 19 VAC 
wall transformer connector into J2. 
Close SI by rotating R6 clockwise. 
Check for +12 VDC between 01 pin 8 
and 02 pin 5 (Gnd). Next, check for 
-12 VDC between 01 pin 11 and 01 
pin 5. If these voltages are not 
measured, there may be a problem 
with the installation of D3, D4, 03, or 
04. Once the proper voltages are 
established, install 01 and 02. Attach 
an oscilloscope probe at 02 pin 3. 
Turn the amplitude control (R6) fully 
clockwise. 

The oscilloscope should show a 
measure of 10 Vpp. If this is not 
measured, there may be a problem 
JUNE 2004 


KIobby Engineering 

The technology builder's source for kits, components, supplies, tools, books and education. 


ICs, Transistors, Project Kits 

Motors, Frame Components 
and Scratch Builder Supplies. 


I Order by Internet, phone, fax or mail. 
www.HobbyEngineering.com | 

1-866-ROBOT-50 


BEAM Kits and Components 


1-650-875-0715 
1-650-952-7629 (fax) 
sales@HobbyEngineering.cc 


ir showroom near SFO! 


Most orders ship the day received! World-wide shipping. Convenient payment options. 



Sine Wave Signal Generator 



with the installation of R5 or R6. Keeping the 
probe on U2 pin 3, set S2 on high frequency 
(switch position up). The output frequency 
measured should be variable from 1,000 Hz to 100 
kHz by turning R1 and R2. 

Likewise, when S2 is on low frequency (switch 
position down), the frequency can be varied from 
10 Hz to 1,000 Hz by adjusting R1 and R2. Once 
these conditions are met, install Q1-Q4 into their 
sockets (refer to Figure 2). The output at J1 
should match the signal at U2A pin 3. 

Now, check the output current limiting. 
Connect J1 to a 10Q 2W resistive load. Then, 
measure the voltage across the resistor with an 
oscilloscope. Increase the amplitude until the sine wave 
output starts to clip. The should occur at 2.0 Vpp. If this 
is not the case, check for proper installation of Q1-Q4, 
Dl, D2, and R7-R10. Q1-Q4 are mounted in sip sockets 
for easy replacement, in case they still manage to get 
fried. 

Once the unit is fully operational, install the PCB in the 
case using eight 1/4 inch 4-40 screws and four 1/2 inch 
4-40 threaded nylon spacers. 

Finally, attach the lid using the screws included with 
the case. 


Summary 

Now that the unit is fully assembled, it can be used 
as a sine wave signal generator. This device is good for 
testing circuits in the audio frequency range. For 
frequencies above 20 kHz, there will be slight frequency 
drift in the output signal. The Coarse and Fine controls 
allow for precise frequency adjustment and the output is 
adjustable from 0 Vpp to 10 Vpp. Furthermore, the unit is 
short circuit protected at ±100 mA. This signal generator is 
a useful addition to any electronic hobbyist’s bench. NV 



• Linux 2.4 Kernel 
•486-1 33MHz SBC 

• 10 Base-T Ethernet 

• 8MB DOC Flash Disk 

• 16MB RAM 

• Power Supply 

• Carrying Case 

• Starting at $399.00 

• X-Windows (option) 

• RealTime Linux (option) 


I magine running Embedded Linux on a Single 
Board Computer(SBC) that is 4.0" x 5.7" and 
boots Linux from a Flash-Disk. No hard drives, 
no fans, nothing to break. Now your hardware 
can be as reliable as Linux! If your application 
requires video output, the X-Windows upgrade 
option provides video output for a standard 
VGA monitor or LCD. Everything is included; 
Ready to Run Linux! 

EH1AC inc. 

Equipment Monitor And Control 

Phone:(618)529-4525 • Fax:(618)457-0110 « www.emacinc.com 


Since 1985 

18 

SINGLE BOARD 
SOLUTIONS 



Looking for a Little 

Metal? 


Robodyssey Systems LIC 

That's just the first thing we're 
going to change in Personal 
Robotics 


www.robodyssey.com 












ASK-1 204TR 1.2 GHz, 1W, 4 Channel System 

* | - Super high power 


QUALITY PRODUCT 
FAST DELIVERY 
COMPETITIVE PRICING 


! UL approved 
! Single & Double sided 
! Multilayers to 8 layer 
! SMOBC, LPI mask 
! Reverse Engineering 
! Through hole or SMT 
! Nickel & Gold Plating 
: Routing or scoring 
! Electrical Testing 
! Artwork or CAD data 
! Fast quotes 


yogii@flash.net • flash.net/~yogii 


□•NrfOMu 


uMMC 


$59.95 
QTY 1 

OEM $30 QTY IK 

ROGU^ 


You can 
of N 

WWW, 

something 1 
order back issues 
uts & Volts at 

nutsvolts.com 

c 

80 

Stoc 

)r call us at 

0-783-4624 

k up today! 


GET YOUR IDEA INTO SHAPE WITH 

LOCK 

Rapidly Create 

Mechanical Prototypes 

Parts, Brackets, Housings, Molds, Etc 
Amazing Plastic Melts in Hot Water 
Locks Rigidly at Room Temperature 
Super Strong, Tough, Safe, Reusable 
250 Grams for $14.95 plus S/H 
Free Sample Offer and Information: 
WWW.SHAPELOCK.COM 


749/Ser 1 - Standard transmit 

| | range 1000' 

" Built-in switcher for 

lisn .“ s * e 

$99/set ASK-2008TR 1 .2/1 .7/2.4 GHz, 

~ j iff! 50 mW ’ 8 Channel Systems 

\ ' Transmit range up to 800' 

- 12 Channel Available 

l , - Built-in channel switcher 

■ for auto scan 

JsSKB " 1000 mW booster optional I 

Callfor Custom Frequency f 

Mateo, Inc. www.matco.com 
Sales:(800)-719-9605 Fax:(847)-303-0660 


Special p/todacts and se/u/iees ( : o;i the eKect/tonics Enthusiast. 

K 1 TETSU^lN 2004 


This groundbreaking, cutting edge 
powered exoskeleton competition is 
sponsored by our sister publication, 
SERVO Magazine. Check out the articles 
SERVO is publishing highlighting the 
technologies involved in the project 
design. Details for the competition, which 
^will be held this fall, can be found at: 

www.servomasazme.com 


J PRINTED CIRCUIT BOARDS 


FEEL LIKE YOU MISSED THE BOAT? YOU DID! 
BUT YOU CAN STILL GET ON BOARD! 

issues of the premiere issue of Ala gezine 

end The Nuts 8i Volts of /tmateur IZobotios ere e\ /eiiebie 


^ : 


I The Pocket Programmer Only $149.95 H 
I The portable programmer that uses the 
I printer port instead of a internal card, 

I with easy to use Windows software that 
| programs E(E)prom, Flash & Dallas Ram. 

Intronics, Inc. • Tel. (913) 422-2094 
| Box 12723 / 612 Newton / Edwardsville, KS 6f 
Add $8.00 COD 
1 WWW.IN-KS.COM Visa/MC/Amex/Disc 



Nufs&Vous 


DSP 


Learn DSP and have fun! By using MATLAB and your PC soundcard, you can get results 
instantly and anchor concepts that might be difficult to grasp otherwise. 


T he inspiration for this idea came from my students. 

Teaching DSP is difficult because you must slog 
through a fair amount of math before getting useful results. 
1 noticed that, during my lecture on Z transforms, most 
students had donned their Walkmans/MP3 players. Their eyes 
were rolling. I needed drastic measures to turn this around. 
So, why not use the students’ love of music as a tool for 
teaching DSP? (Yes, I loved the movie The School of Rock.) 

MALAB has a whole set of DSP-like features that you 
can use in a visual environment called SIMULINK. One 
can import WAV files and manipulate them easily with 
filtering, etc. I decided that an easy and convincing 
experiment would be for students to take their favorite 
songs, record them as WAV files, and then filter them 
using DSP. Simple Low Pass Filters can be used to band 
limit the signal and monitor quality. 


• PC with Windows 95/98/XP/2000 (See Note I.) 

•Windows Sound Recorder application 

• MATLAB/SIMULINK 6.5/RI3 with DSP Toolbox (See Note 2.) 

• Portable Music Device: Walkman, Discman,MP3 player, etc. 

• Male audio plug to male audio plug jumper cable 

• Sound card with speakers or external amplifier 



shows a typical setup. A tape player headphone output is 
connected to the PC sound card microphone input via a 
jumper cable (male audio plug to male audio plug). 

Windows Sound Recorder 

1 asked the students to record 30-second takes using 
varying sampling rates and bit resolution. A typical 
selection is shown in Table 1 . The students can then play 
these files back through Sound Recorder (Figure 2) to 
find the effects of various sampling rates and resolutions. 
Depending on the original quality of the music, the lowest 
sampling rates/resolution give the lowest quality. 

After the files are tested, they are moved to the 
MATLAB/Work directory. The MATLAB program is 
followed by Simulink (button on the MATLAB toolbar just 
under Help), as shown in Figure 3. In Simulink, a new file 
model is opened and placed adjacent to the Simulink 
Library Browser. The DSP Blockset is found and the 
following blocks are moved to the open model file: 

• From Wave File (Platform Specific I/O — Windows) 

• Digital Filter Design Tool (Filtering — Filter Designs) 

• To Wave Device (Platform Specific I/O — Windows) 

Matlab/Simulink Environment 

The modules are joined using the mouse. By clicking 
the “From Wave File” box, the music files can be accessed 



In order to conduct this experiment, I asked all of my 
students to bring their normal portable music device 
(Walkman, Discman, MP3 player, etc.) to the lab. 
Windows Sound Recorder was used to convert the output 
of the music device to an appropriate WAV file. Figure 1 


Equipment Requirements 


58 


JUNE 2004 






WITH MATLAB AND A PC SOUNDCARD 


by Jeremy Clark 



by just typing in the correct file name. Note that they must 
be stored in MATLAB/work directory. The digital filter can 
be set up by clicking that module. Various filters can easily 
be designed. A simple Butterworth low pass filter can be 
implemented to filter the music. The effects of cutoff 
frequency can be convincingly demonstrated (Figure 4). 

DSP Theory 

The block diagram in Figure 5 shows the DSP process. 
An input analog waveform X(t) is first low pass filtered to 
an upper frequency less than or equal to half the sampling 
frequency (Nyquist sampling theorem). This signal is then 
fed to an analog to digital converter. The converter 
samples the input waveform at the sampling frequency 


and with resolution nbits/sample. The binary samples 
X(n) are then presented to the DSP process. The DSP 
process performs the required operation. This operation is 
represented by the DSP difference equation or equivalent 
Z transform. The output of the process Y(n) is then recon- 
verted back to the analog domain by the Digital/ Analog 
converter. The final low pass filter ensures that all alias 
components caused by the DSP process are removed. 

The music files in analog format are converted to 
binary samples via Windows Sound Recorder. These WAV 
files are non-compressed pulse code modulation binary 
samples. The MATLAB environment inputs these digital 
samples to a DSP algorithm represented by the digital 
filter. The output samples are then converted back to 
analog by the sound card D/A and low pass filter. NV 



X(t) 


X(n) Y(n) 


Y(t) 



File Name 

Sampling Rate 

Resolution 

Nyquist Max. 
Base Band Freq 

Composite Bit 
Rate 

music_8_8.wav 

8 kHz 

8 bit 

4 kHz 

64 Kbit/sec 

music_22_l6.wav 

22.05 kHz 

16 bit 

1 1 .025 kHz 

352.8 Kbit/sec 

music_44_ 1 6.wav 

44.1 kHz 

16 bit 

22.05 kHz 

705.6 Kbit/sec 


Table 


JUNE 2004 


59 








S110AIJ1QN 


WORKING WITH 

DIGITAL FILTERS 


by Peter Best 


M ost of the books and technical papers that describe 
digital filtering consist mostly of complex mathematical 
concepts with little to no emphasis placed on the practical 
implementation of a physical digital filter. The math behind 
digital filtering techniques is indeed interesting, but you 
don’t have to be a mathematician to design and build a 
working digital filter. Keep reading and I’ll prove it to you. 

Poles and Zeros 

Digital filter theory and the math that accompanies it 
describe the process of placing a number of poles and 
zeros at strategic locations in complex mathematical 
planes to obtain a desired filter response. For filter 
designs that are realized in the mathematical S plane, the 
filter response is called the system function (Hs). The 
system function is actually based on the division of two 
sets of complex polynomials. 

Mathematically, the poles of a filter are the roots of 
the system function’s complex polynomial denominator 
and the filter’s zeros are the roots of the system function’s 
complex polynomial numerator; this results in the system 
function Hs. The poles and zeros are represented physically 
by resistors, capacitors, and opamps. Digitally, poles and 
zeros and their placement in a plane are represented by 
firmware-resident coefficients and a filter kernel. 


Figu 

7 

re /.This low-pass filter imp 
1 points or taps that we cou 
digital filter a 

ulse response plot contains 
d use as coefficients in a 
gorithm. 


Impulse Response - Passband = IkHz - Stopband = 1.1kHz 

0.24 
0.20 ■ 

■S 0.16 
| 

m 

.11111 
_l 1 + 1. 1 

Li j i i i 

\\ i i i i 

-HI— t — + — 1 1 

li i i i i 

i- 

-i — 
i 

— H — 
1 

-4 — 
1 

i 

Tf 1 T T 1 

-4-1 — ) — + — 1 — 1 
ii i i 1 i 

0.00 

-0.04 

\ u /v A fi 

"tr/r i 

\ 1 / A 1 /% 1 — i / 1 

vT^i vi ui 

ii... 

ii/ v v v i 

■"V — i — -t — i — i 
11111 


>12 3 4 

5 6 7 8 9 


60 


A filter kernel is really the impulse response of the 
filter. Mathematically, an impulse is a spike of sorts that 
occurs at time = 0 with infinite positive amplitude. In 
addition, a mathematical impulse has no width and a total 
area that is equal to 1 . Applying an impulse to a filter — 
which excites the filter equally at all frequencies — results 
in a response from the filter — which is the filter’s impulse 
response. We care about impulse response because a 
filter’s impulse response plot contains the points (the 
filter kernel) we use for coefficients that are used in our 
digital filter firmware algorithm. A typical low-pass filter 
kernel or impulse response plot can be seen in Figure 1. 

The best way to describe poles and zeros is to 
imagine a square yard of very flexible rubber stretched 
horizontally, one inch above a piece of plywood. The 
stretched rubber is the mathematical plane S. A zero is 
formed in the plane by placing a thumbtack through the 
rubber, into the plywood. The tack forms a depression in 
the rubber that is shaped like a funnel cloud. This is a zero 
and mathematically it extends infinitely negative. 

Frequencies in the plane that are close to zero points 
are attenuated. If you placed two tacks (zeros) six inches 
apart and pulled up the rubber in the center between the 
tacks, you will create a pole between the two zeroes. 
Frequencies near the poles in the planes are amplified. 
Mathematically, a pole extends infinitely positive. Imagine 
being able to tack down areas and pull up areas of the 
rubber plane to adjust the attenuation and amplification of 
certain frequency areas. That’s what poles and zeros do. 

Filter order is determined by the number of poles the 
filter contains. For instance, a filter with two poles is 
termed a second order filter. More poles and zeros mean 
more code; thus, more time will be needed to evaluate the 
filter kernel and incoming data samples in a digital filter. 
For an analog filter, the number of poles and zeros 
determines how much hardware you’re going to be 
assembling. The more poles and zeros that are included 
in the analog filter design, the more resistors, capacitors, 
and opamps you’ll have to add to create them. 

The tradeoff for an increased number of poles and 
zeros (filter order) for both digital and analog filters is 
better filter response. For instance, a simple RC low-pass 
filter (Figure 2a) contains a single pole. The Sallen-Key 
filter configuration in Figure 3 has two poles. Because 
filter gain and filter output impedance can be controlled, 
the Sallen-Key active filter will perform better than the 
JUNE 2004 




Figure 2a. If an impulse is applied to this 
circuit, the time taken for the output 
to ramp up to the input voltage is 
determined by the size of the resistor. 
The higher the resistance, the longer it 
takes to charge the capacitor, thus, the 
slower the ramp up process. 


TT 

1 1 


simple passive RC filter network. A 
second pole can be added to the RC 
filter by simply adding a second RC 
filter at the output of the first RC 
filter, as shown in Figure 2b. 

Since there are no zeros in either 
the Sallen-Key or the RC filters I’ve 
described, they are called all pole 
filters. Mathematically, the numerator 
of the system function Hs for the RC 
and Sallen-Key all pole filters is 1 , as 
all of the work is done with poles, the 
roots of which are found in the 
denominator of the system function. 

All of this pole and zero talk is 
important, as poles and zeros 
determine how a filter responds and we, as humans, have 
names and generic S-plane pole-zero plots we can tie to 
those generic filter responses. We won’t be plotting pole 
and zero functions during the course of our digital filter 
design, as it isn’t a necessary process in the generation of 
our digital filter. Instead, we’ll use Microchip’s Filter Lab 
application to put the poles and zeros in the correct places 
and compute the values of our Sallen-Key filter components. 
If you want to take a look at some pole-zero plots, one of 
the best application notes I’ve seen that illustrates the pole 
and zero concept with actual three-dimensional color plots 
is the Dallas/Maxim application note APP 733. 


resistors and capacitors. Now that you’ve generated a 
high-pass filter from a low-pass filter kernel, you can take it 
a step further and add the low-pass kernel and the high- 
pass kernel you just generated to form a bandstop filter. 

No matter which filter model you choose, the ideal 
filter would have absolutely no frequency gap between the 
passband and stopband. This no-gap scenario is called a 
brickwall response, which is envisioned as a theoretically 
perfect filter with a vertical drop of the attenuation from the 
passband to the stopband. In a physical filter, there will be 
some gap between the passband and the stopband. This 
gap is called the transition band. The width of the gap is 


Filter Basics 

There are three common filter types that are used to 
describe the behavior of both digital and analog filters. The 
three filter models — or approximations — are called 
Chebyshev, Bessel, and Butterworth. You’ll sometimes see 
Chebyshev spelled in many other ways, including 
Tschebyshceff. To understand the characteristics of each 
of the filter types, you must first understand the terminology 
used to describe a typical digital or analog filter. 

A filter will pass signals at their maximum amplitude in 
an area known as the filter’s passband. Conversely, a filter 
will severely attenuate and block signals in its stopband area. 
A high-pass filter passes frequencies above its cut-off frequency 
and blocks them below its cut-off frequency. A low-pass filter 
passes signals below its designed cut-off frequency and 
blocks them above the cut-off frequency. A bandpass filter 
passes signals that are inside a particular frequency range 
and a bandstop filter blocks signals in a frequency range. All 
of these filter types have one thing in common. They can all 
be derived from a low-pass filter design. 

A high-pass filter is the spectral inversion of a low-pass 
filter. To spectrally invert a filter kernel, you only need to 
apply opposite signs to each filter kernel point and add 1 
to the center filter kernel sample. I used an application 
called ScopeFIR to generate the low-pass filter kernel in 
Figure 1 and its spectrally inverted high-pass kernel in 
Figure 4. The physical low-pass filter configurations in 
Figures 2 and 3 can be converted to high-pass filter 
configurations by simply swapping the locations of the 
JUNE 2004 


Hobbyists, Designers, Students: 


Wh’ 


I hy wire-wrap when you can get 
PCB prototypes for much less? 

Our Standard PCBs include 
Tooling, Mask, and Legend 


2 Layer 


4 Layer 

5 day 


5 day 

$13 each 


$33 each 


Our “Bare PCBs” have no mask and no legend 
but can give you even more SAVINGS! 

$40 lot + 60cents per square inch 
for 2 layer Bare PCBs 
Easy Online Ordering at: 
www.PCBFABExpress.com 


® 


PCB FABEXPRESS 

High Quality PCBs @ Low Impact Prices 


Email: support@pcbfabexpress.com Tel: (408) 857 0039 

Circle #1 1 2 on the Reader Service Card. 










Figure 3. This circuit can be used to implement Chebyshev, 
Butterworth, and Bessel analog filters 
by simply changing the values of the components. 


referred to as the transition bandwidth. As the transition 
bandwidth gets smaller, the filter’s frequency response 
improves accordingly. Transition bandwidth is inversely 
proportional to the number of poles in the filter. 

Figure 5 shows a filter design that has a passband of 
1 kHz and a stopband of 4 kHz with a stopband 
attenuation of -30 dB. Note that the ideal passband cutoff 
of 1 kHz doesn’t really occur until sometime beyond 2 kHz. 
You can safely assume that this filter design won’t require 


many components and won’t take up much 
space in a microcontroller’s memory area. 

Judging from the transition bandwidth, you 
can also assume that this filter will not be very 
responsive to small changes in frequency. By 
adding some poles and zeros and specifying a 
lower stopband frequency, Figure 6 shows that 
the width of the transition band narrows and 
sharpens the roll-off at the start of the transition 
band. This filter design requires quite a bit 
more firmware and hardware than the filter 
design depicted in Figure 5 and is much more 
responsive to small changes in frequency. 

Filter Comparisons 

The Chebyshev filter has a sharper roll-off 
than the Butterworth and Bessel filter models. The 
Chebyshev filter uses ripple in the passband to achieve the 
sharp roll-off characteristic. The more ripple allowed in the 
Chebyshev passband, the sharper the roll-off that can be 
obtained from the filter. Although the Chebyshev filter does 
a great job at discriminating frequencies, it has a relatively 
poor step response when compared to a Bessel filter. 

Poor step response means that the Chebyshev does a 
poor job of filtering signals with sharply rising and falling 
edges. The Chebyshev filter will over- 
shoot and undershoot on the rising and 
falling edges of the input signal. You’re 
already familiar with this phenomenon: 
It’s called ringing. The Chebyshev filter 
is composed of poles only. A Filter 
Lab-generated Chebyshev frequency 
response plot is shown in Figure 7. 

Ringing on the rising and falling 
signal edges can be eliminated by 
employing a Bessel filter model. 
Unlike the Chebyshev filter, the Bessel 
filter does not contain any ripple in the 
passband or the stopband. However, 
the Bessel filter’s roll-off rate of 
attenuation in the transition band is 
the worst of the three filter models. 
The Bessel filter shines with sharp- 
edged signals as it introduces very little 
overshoot or ringing and preserves 
the majority of the sharpness of the 
filtered signal’s edges. Thus, the 
Bessel filter model is a good choice 
for filtering time domain signals. The 
Bessel filter model in Figure 8 contains 
no zeros and is an all poll filter. 

As you can see in Figure 9, a 
Butterworth filter is maximally flat in 
the magnitude response in the filter’s 
passband with no ringing in the 
stopband. Like the Chebyshev, the 
JUNE 2004 



62 





Figure 4. This says it all. The top sine wave’s amplitude 
decreased as I increased the input frequency towards 
the digital filter’s I kHz bandstop value. 


Butterworth filter is good for separating bands of frequencies. 
The Butterworth filter stands in the middle as far as 
transition band attenuation is concerned. Butterworth’s 
filter transition band attenuation is better than the Bessel’s, 
but worse than the Chebyshev’s. The step response of a 
Butterworth filter is slightly better than the Chebyshev step 



response. There are no zeros in the transfer function of a 
Butterworth filter. Thus, like the Chebyshev and Bessel 
filter models, the Butterworth filter is an all pole filter. 

Butterworth and Chebyshev filter models work best in 
the frequency domain, while the Bessel is a better time 
domain signal filter. It’s easy to determine if you’re looking 


Surplus Sales of Nebraska 


Weston 1751 Series Meters 


(MTR) 1 751 -62 H 

1 1 0 - 1 00% Cam Dwell If • v 1 

0 - 200 uadc full scale. 

^ (MTR) 1751-63 I 

1 • *' I Vacuum Pressure 1 _ 5 ■’.%! ( 

500 - 0 - 500p amps i 

HH Needle reversed. 

DC full : 



(MTR) 1751-67 

0-10/ 0-50 amps DC FT 

1751-69 | 

0-10/0-20vdc 

■X ~ v l 1 made full scale. MX i 

mM M 

” ’ll made full scale. MC -*• ' 1 : 

m mm 

$22 each - 5 or more for $20 each - Mix & Match 


(MTR) 1751-65 

0-10/0-50 RPM 
in 100's. 1 made full 


** Screen Your Own Meters!! Blank White Meter Faces available!! $2 each **' 


(PS) 10656X 

Yes, we still have a good supply 
of this new, wonderful Deltron 
triple voltage open frame linear 
supply. So versatile. Trim the 15 
vdc fundamental supplies on the 
circuit board. 12-16v or remote 
mount a 10 turn 5k Ohm pot and 
turn it into a 7-30v regulated lab supply. It’s simple 
to do. Instructions included. Series or parallel the 
two supplies for a combined 7-60v @ 2.5-5 amps. 
Board trimmable current limiting too. New, boxed, 
from Collins surplus. 10 pounds each. 3-1/4" x 5" 

Xl1 l0n9 ' $35 each - $32 (3+) 


Please visit our website with over 2,000 pages and 10,000 images • www.surplussales.com 


1 HI Manuals : 1,000s of radio, military and test 
I equipment manuals on hand!! 


Split Beads : For are all of your interference 
problems. 


I Metal Halide High Intensity Lamp Ballasts 


* 


Kapton. Fiberglass and Mylar Tapes 



Enclosures : Rack Cabinets, Builder 
B Boxes, Shipping Containers 

1502 Jones Street, Omaha, NE 68102 • Fax: 402-346-2939 • e-mail: grinnell @ surplussales.com • Visa, Mastercard, American Express or Discover 
Call or e-mail for shipping and total charges. All SPECIALS in this Ad only good for 30 day advertising cycle. No exceptions please. 

wwvwsurpiussaiesicom 800-244-4567 • 402-346-4750 


JUNE 2004 




NutS&VOLTS 




at a time or frequency domain filter plot. If the X axis is 
measured in units of time, you’re in the time domain and 
the information is carried as a function of time. If the X axis 
is measured in units of frequency, you’re operating in the 
frequency domain, in which the signal’s information is 
carried as a function of frequency. Don’t let the logarithmic 
scales throw you. The information contained in a log plot is 
the same information that would exist in a unit plot of the 
same data. Log scales are used when standard unit scales 
can’t dynamically give your eyes the full impact of the plot. 

You’re all set on basic filter theory as now you know 
that, to design an analog low-pass filter, you will need to 
specify the passband frequency, the stopband frequency, 
and the stopband attenuation. The same is true for a 


digital low-pass filter design. You also know that, once you 
design a low-pass filter, you can derive any other filter 
type from your low-pass filter kernel. You’ve also been 
introduced to two applications: ScopeFIR and Filter Lab, 
which help take the tedious math out of designing filters. 
In the text that follows, we will design and build some 
analog and digital filters using ScopeFIR and Filter Lab. 

The Digital Filter Hardware 

Digital filters have many advantages over analog 
filters. To change the characteristics of a digital filter, all 
you have to do is change some code versus altering physical 
components in an analog filter. Another advantage of 
using a digital filter is that there are no physical components 
that can drift in value and degrade the performance of 
your filter. Even with those extras, a good digital filter is 
incomplete without an analog filter counterpart. This 
sidekick analog filter is known as an anti-aliasing filter. 

Our digital filter input is gathered by the analog-to- 
digital converter module in a PIC18F452. The maximum 
frequency that our PIC-based digital filter can resolve is 
set to one half of the sampling frequency, which we will 
set to 8 kHz. If we attempt to sample a signal that has a 
frequency component above one half of our sampling 
rate, we will record an aliased signal, which will not 
represent the true input signal. 

Aliasing occurs when signal components above one 
half of the sampling rate are folded back and appear as 
lower frequencies in the digital output. It’s the anti-aliasing 
filter’s job to block any signals above one half of the sampling 
frequency and pass all other signals below one half of the 
sampling frequency to the PIC18F452’s analog-to-digital 
converter unchecked. The one half of the sampling frequency 
value is known as the Nyquist 
frequency or Nyquist rate. 

If you check out the schematic 
(Figure 13), you’ll see that I’ve 
devised a digital filter circuit using 
a PIC18F452 that includes a 
Microchip MCP604 quad opamp, 
a couple of Microchip MCP42100 
dual digital potentiometers, a 
+5 V DC regulated power 
supply, a Sipex SP233ACP-based 
serial port, a Microchip ICSP 
programming port, and a 40 MHz 
microcontroller clock. My 
prototype digital filter board can 
be seen in Figure 1 1 . 

A typical digital filter 
configuration consists of an 
anti-aliasing filter feeding an 
analog-to-digital converter with 
the output of the digital filter 
flowing into a digital-to-analog 
converter. A pair of opamps in 
JUNE 2004 






the MCP604 handles the 
anti-aliasing and digital-to-analog 
converter duties with both 
opamps being supported by the 
full complement of MCP42100 
100K Q digital potentiometers. 

Along with a quad of capacitors, 
the MCP604 and MCP42100 form 
two Sallen-Key filter configurations 
that are dynamically controlled 
via the digital potentiometers, 
which are adjusted using a personal 
computer-resident control program. 

Since every digital pot has a 
different end-to-end (PA-to-PB) 
resistance, the digital filter control 
panel has dials to set the actual 
digital potentiometer PA-to-PB 
resistance so that each click of 
the potentiometer’s virtual dial 
displays the correct resistance in 
the digital filter control panel’s 
virtual LED displays. 

Microchip’s Filter Lab program 
is used to determine the Sallen- 
Key analog filter resistances for a particular filter type 
(Chebyshev, Bessel, or Butterworth) and cut-off frequency 
and the computed resistances are transferred to the digital 
potentiometers using the digital filter control panel’s 
virtual dials and a serial connection between the personal 
computer and the digital filter electronics. 

There is no practical way to adjust the capacitors in 
the analog filter circuits. So, fixed capacitor values were 
chosen that provide a wide range 
of analog filter bandwidth when 
combined with the 100K Q digital 
potentiometers. The digital filter 
control panel also allows remote 
control of the PIC18F452’s PWM 
(Pulse Width Modulation) module. 

The digital filter control panel — 
along with the opamps, fixed 
capacitors, and digital potentiome- 
ters — allows us to create any of the 
three basic filter types (Chebyshev, 

Bessel, or Butterworth) and 
specify the analog filter response 
without having to swap physical 
components. To add to that 
flexibility, the opamp is not 
committed to a printed circuit 
board land pattern. This allows 
the user to configure the quad of 
opamps in any way desired. 

There’s nothing unusual 
about the circuitry surrounding 
the PIC18F452. A standard 


LM340S +5 V DC regulated power supply circuit is included 
onboard the digital filter printed circuit board. The LED I 
used as the power indicator has an internal current limiting 
resistor and sits directly across the +5 V DC output of the 
voltage regulator. 

To establish a communications session between the 
digital filter board and the personal computer, the CISART 
receive and transmit pins of the PIC18F452 are connected 


Figure 9. It takes a higher order Bessel filter to be as responsive as a typical 
Butterworth filter. However, the trade-off is worth the extra firmware in a 
digital filter and the extra hardware in ananalog filter design. 



Frequency (Hz) 


65 


JUNE 2004 




in a standard way to the Sipex SP233ACP RS-232 
converter, which, in turn, interfaces to the outside world 
via a standard nine-pin shell connector as a DCE device. 
By making the digital filter board’s RS-232 port DCE, the 
need for an RS-232 crossover cable is eliminated. 

The SPI module of the PlC18F452’s MSSP (Master 
Synchronous Serial Port) drives the digital potentiometers 
and a 40 MHz crystal oscillator provides the clocking 
for 100 nS instruction cycles within the PIC18F452. A 
standard Microchip ICSP port is also a part of the digital 
filter board and allows the use of the MPLAB 1CD2 
hockey puck for programming and debugging. 

You can easily assemble the digital filter electronics 
using point-to-point techniques. If you go the point-to- 
point route, you can substitute a DIP version of the Sipex 
SP233ACP for the SMT version on the digital filter printed 
circuit board. For those of you that prefer a printed circuit 



board and a full complement of components, I’ve made 
arrangements with the folks at EDTP Electronics to 
provide a full kit of parts — which they call the Digital 
Filter Development Kit. The digital control panel 
application and the digital filter PIC18F452 firmware are 
free downloads and you can get them from the Nuts & 
Volts website at www.nutsvolts.com or the EDTP 
Electronics website at www.edtp.com 

Coding and Using the Digital 
Filter 

The firmware for the digital filter is written using a 
combination of PIC C and PIC assembler. The PIC 
assembler code is used for speed. Sampling at 8 kHz 
means that we have 125 |iS to perform the digital filter 
work before a new sample is taken. We want to cram 
every possible digital filter instruction we can between the 
taking of the samples. Therefore, assembler is used for 
coding of the math and digital filter routines. 

Using PIC C allows the easy allocation of memory 
elements to hold the digital filter coefficients and data. The 
C constructs also eliminate having to code all of the house- 



JUN £ 2004 




keeping stuff when making calls to subroutines and functions. 

Arrays, constants, and variables that are defined in C 
can be accessed by their C-assigned names in the assembler 
routines. Thus, all of the PIC18F452 internal peripheral 
setup, the allocation of arrays and constants, and the 
RS-232 interrupt handler are written using C. The Custom 
Computer Services PIC C Compiler, in conjunction with 
Microchip’s MPLAB IDE, is used to compile the assemble 
RC code combination. I used a Microchip MPLAB ICD 2 to 
program and debug the digital filter’s PIC18F452. 

The PIC18F452’s Timer2 and Capture/Compare 
Module2’s trigger special event mode are programmed to 
automatically kick off an analog-to-digital conversion every 
125 (xS. That’s where the 8 kHz (1/125 pS) digital filter sample 
time number comes from. To avoid having to add a negative 
voltage reference for the PIC’s analog-to-digital converter, 
the anti-aliasing filter’s input is capacitively coupled and a 
+2.5 volt offset is added to the incoming signal by the 
voltage divider produced by R1 and R2. Doing this sets our 
analog-to-digital converter zero point in the center of the 
PIC18F452’s 10-bit analog-to-digital converter range and 
allows the input signal to swing ±2.5 volts, which equates to 
0 to 5 volts at the analog-to-digital converter input. 

In order to keep input and output signals in balance, 
that means our digital filter output zero point must also be 
set for 2.5 volts. This is easily done by simply using the full 
10-bit resolution of the PIC18F452’s PWM module. A value 
of 0 x 1 FF is the offset zero point (+2.5 volts) of our analog- 
to-digital converter and the 50% duty cycle mark (+2.5 volts) 
for the PWM module. The digital filter output modulates a 
39.06 kHz PWM signal that is produced by the PIC18F452’s 
PWM module. The PIC’s PWM module and the Sallen-Key 
filter that it is feeding form a digital-to-analog converter. 

Put a voltmeter or scope probe on the output of this 
PWM-fed filter and you’ll see +2.5 volts when the 
PWM duty cycle is at 50%. The ON/OFF switch 
inside the digital control panel’s Pulse Width 
Modulation Manual Control box kills the automatic 
analog-to-digital converter process and turns off 
the digital filter code inside the PIC18F452. This 
allows the direct control of the PIC18F452’s PWM 
module. To see how the PWM duty cycle relates to 
the voltage produced by the output filter, attach a 
voltmeter to the output of the SIGNAL OUT pin, 
switch on the manual control, and turn the virtual 
DUTY CYCLE knob. You’ll see the voltage on the 
SIGNAL OUT pin rise and fall with the increase 
and decrease in the PWM duty cycle. Be sure to 
turn the manual PWM controls off when you’re 
running a digital filter kernel. 

Speaking of digital filter kernels, let’s generate 
one for a low-pass FIR (Finite Impulse Response) 
filter using the ScopeFIR application. ScopeFIR 
doesn’t use any of the three filter models you’ve 
been introduced to. We’ll use one of those models 
for the analog anti-aliasing and analog digital-to- 
analog filter. Instead, ScopeFIR uses the 
JUNE 2004 



Figure 1 1. If you’re wondering where the analog filter resistors 
and caps are, I breadboarded them in with 0805 SMT 
components on the bottom side of the board. 


Parks-McClellan or Optimal Equiripple method to generate 
an optimized linear-phase FIR filter. Many of the free FIR filter 
coefficient generators that are available via the Internet use 
the Parks-McClellan algorithm (ScopeFIR is not free if you 
want the bells and whistles). Figure 12 shows a ScopeFIR 
session that has generated a filter kernel for a low-pass 
filter with a 500 Hz passband frequency and a 1 kHz 
stopband frequency with a -30 dB attenuation factor. 

If you investigate the filter’s impulse response plot 
points, you’ll note that they are all less than 1. To make 
these coefficient numbers easier to handle with our assembly 
code math routines, we multiply — or scale — them by 
32,768 or 215. If you’re wondering about the negative 
coefficient values, they are the 16-bit hex numbers that 
have their most significant bit set to 1. This is called 1.15 
format. That’s fancy talk for 1 sign bit and 1 5 data bits that 
represent a fractional number. I instructed ScopeFIR to do 
the 32,768 multiplication automatically after the filter kernel 
was built. Once the 16-bit coefficients are determined, they 



67 




Nuts&Volts 



C11 



Figure 13. These values represent a Chebyshev low-pass filter with 
a 3 kHz bandpass and 13 kHz stopband. The stopband attenuation is set 
for -30 dB and the pass bandripple is set for 3 dB. 


are included as constants in the digital filter firmware; 
more details on determining these are shown in Note 1 . 

Okay. Now that we have a kernel and some 
coefficients, we can apply them to the sum of products 
algorithm that form the heart of a FIR digital filter. The 
sum of products code implements a series of multiply 
and accumulate operations that follow the formula: 

y[n] = a*x[n] + a-l*x[n-l]+ a-2*x[n-2]+... a-j*x[n-j] where: 

y[n] = output signal 

a = first coefficient 

x[n] = current input signal point 

a-1 = next coefficient 

x[n-l] = next input signal point 

until the last signal point and coefficient a-j*x[n-j] 

Each multiplication operation between the additions 
corresponds to a tap (coefficient) of the digital filter, 
which corresponds to a point in the filter kernel. The sum 
of products process plays the digital filter’s coefficients 
(filter kernel) against the incoming signal. This process is 
called convolution. Ultimately, every incoming signal 


Figure 1 4 . With the help of Microchip’s Filter Lab and 
ScopeFIR, the digital filter control panel provides a means of 
quickly evaluating analog and digital filters. Note that I dialed in 
as close asthe potentiometers would allow. 



sample is convolved with every coefficient 
yielding a string of digitally filtered signal points. 

The digitally filtered signal points are numbers 
that represent voltages. The digitally filtered 
signal points are scaled back (divided by 32,768 
because we multiplied them by 32,768 earlier in 
the process) and applied to the PIC18F452’s 
PWM control registers and modulate the PWM 
accordingly. The output analog filter is configured 
to eliminate the 39.06 kHz PWM signal and only 
allow the filtered output to flow through. 

So far, we’ve generated a filter kernel and 
entered the coefficients into the PIC code. Before 
we can process a signal through our digital filter, 
we must calibrate the digital potentiometers in the 
digital control panel and use Filter Lab to design 
our anti-aliasing and PWM output analog filters. 

I removed the opamp IC from the digital filter circuit 
and powered up the digital filter board. The Microchip digital 
potentiometers automatically set themselves to midpoint 
on powerup. I read 55 KQ across U3 and 54.3 KQ across 
U4. I chose to use a Chebyshev for both of the analog 
filters and set the passbands to 3 kHz with stopbands of 
13 kHz with -30 dB of stopband attenuation. Since this is 
a Chebyshev filter, I also specified a passband ripple figure 
of 3 dB. Filter Lab computed the values for the Sallen-Key 
low-pass filters, as shown in Figure 13. I dialed all of the 
parameters into the digital filter control panel, as shown in 
Figure 14 and clicked the SET FILTERS button. 

On Your Own 

Wow! Figure 1 5 shows the signal at the output of the 
anti-aliasing filter (bottom sine wave) and the resultant 
digitally filtered signal (top sine wave). The closer 1 get to 
the 1 kHz bandstop frequency, the smaller the top sine 
wave gets. We’ve just pulled off a digital filter without 
having to apply any complex math. 1 now pass the digital 
filter tools over to you. NV 


Figure IS. This photo says it all. The top sine wave’s 
amplitude decreased as I increased the input frequency 
towards the digital filter’s I kHz bandstop value. 

A1 *65 U £ 713 H« 


TNAAAAAA 



68 


JUNE 2004 



CLASSIFIEDS 


CLASSIFIED ADVERTISING 

$50.00 Per Inch — No extra charge for color (Limited time offer). 

Classified ads must be paid in full prior to the closing date. 
Visa/MC/Amex accepted. Payment for ads received after the closing 
date will cause the ad to be placed in the following issue, at our 
discretion. Minimum charge is one inch with half-inch increments. 


Components 


No proofs will be sent Ads to be typeset by Nuts & Volts must be 
received by the closing date. Supplied ads must be received by the 
artwork due date. 

Call the office at 909-371-8497 or Email classads@nutsvolts.com 
for closing dates, available sizes, and special prepay discount offers. 


FREE I 20 Pg CATALOG 

Electronic components, kits, 
test equipment, tools, and 
supplies for hams, hobbyists, 
and businesses. Many hard-to- 
find items like variable 
capacitors, vernier dials, coil 
forms, magnet wire, and toroids. 

Ocean State Electronics 
www.oselectronics.com 


RF Transistors, Door Knob Caps, 
Power Supplies, Tubes, Coax, 
Teflon Wire 

2SC2879 2SC2290 3-500Z 4CX250B 

See our website for other products 

www.westgateparts. 


stgatepar 
e 1-800-2 


Plans/Kits/ 

Schematics 


MAGNETIC 

LEVITAT ION K IT 

Suspend 
small objects 
in space 
using 

magnetism! 

Parts: $49.99 
Assm. + tested 
w/power supply 
$64.99 + S/H 
ORDER ON LINE: 



PIC PROJECTS 

FREE CATALOG 

ELECTRONICS HOBBY SHOP 
electronicshobbyshop@cpol.net 


CLASSIFIED 
ADS WORK!! 

CALL TODAY 
( 909 ) 371-8497 


canbotics.com 

Autonomous robots 
Panning proximity sensors 
Motherboards • Motor Drivers 


■ Cost Effective 

■ Laser Cut Plastic 

■ Cutting, Engraving 

■ Paint Riled Engraving 

■ Robotic Parts 


Muscle 



Discover the Future! 
Discover Muscle Wires Motorless Motion 

They actually shorten in length when powered 
and lift thousands of times their own weight! 

• Strong • Silent • Low Voltage • 1 1 sizes • 
Project Book & Deluxe Kit (#3-1 68) just $59.95 

Muscle-Wires.com • Mondo-tronics, Inc. 

Order Toll Free 800-374-5764 



- "Stamp-Like" C Functions- easy programming. 

- 2 Hardware UARTS w/FIFOs, PWM, PCI and more. 

- 30 I/O Lines with interrupts + 20mA source/sink. 

www.MCUResearch.com 



$499/set 
(800)719-9605 sales@r 


Special Price $149 


(800)719-9605 sales@matco.c 


(800)719-9605 sales@matco.c 


Computer 
Hardware Wanted 


DEC EQUIPMENT 
WANTED!!! 

Digital Equipment Corp. 
and compatibles. 

Buy - Sell - Trade 
Call Keyways 937-847-2300 
or email buyer@keyways.c 


^ CONTROLLERS 

Robot Bases. PIC, OOPic, Stamp 
and multi-servo controllers. Also, 
Pocket TestBench. Chips, kits, 
and assembled. 
www.oricomtech.com 




Brandon built his own 
Mars Rover 
out of LEGO bricks. 

His mom gave him 
a subscription to SERVO 
so he could take 
the next step. 

12 issues tor $24.95 
Call 800-783-4624 
or go online: 


JUNE 2004 












NutS&VOLTS 


CLASSIFIEDS 


Security 


.\Ao^.,m,a.tgo.gom 
Color Mini Pinhole Camera 


Size: 0.9" X 0.9" X 0.5" 


mQ*' 


(800)719-9605 sales@matco.cc 


Amateur Radio 


www.4atv.com 



ZAP CHECKER MODEL 270 

WIRELESS INSTALLATION ITER 

■ Detects & locates RFI 



■2 FIXED INTERNAL ANTENNAS -No 


nun mm, , 


WWW.ZAPCHECKER.COM 


Antique Electronics 


WANTED: 


FOR HISTORICAL MUSEUM 
pre- 1 980 microcomputers, 
magazines, and sales literature. 
Floyd, VA 24091-0341. 

540-763-3311 • 540-745-2322 


consumertronics.ne( 

Hi-Tech Survival Offers! 
Electronics, security, energy, 
computers, Net, phones, medical, 
legal, financial, weird. Cat.$1 





70 


Connectors Wire/Cable 


■W 


The RF Connection 

213 N. Frederick Ave.,Ste. I INV 
Gaithersburg, MD USA 20877 

http://www.therfc.com/ 


Complete Selection of MIL-Spec Coax, 

UG-2 1 B/U N^Sor RG^ l”^T4*.$5.00 
UG-2 1 D/U N Male for RG-2 13/214 .$3.25 
N Connectors for 99 1 3/Flexi4XL/9096 
UG-2 IB/9913 ...46.00 / Pins Only.,..4 1 -50 
UG-2 1 D/99 1 3 ..$4.00 / Extra Gasket$0.75 
Amphenol 83- ISP- 1 050 PL-259 $0.90 
UG-I76/U Reducer RG-59/8X, $0.25 
or 5/$ 1 .00 

UG-I75/U Reducer RG-58/58A $0.25 
or 5/$ 1 .00 

SilverTeflon PL-259/Gold Pin, $1.00 
or 1 0/$9.00 


MIL-Spec Coax Available (Teflon, PVC IIA) 
New Product Belden 99 1 3F, 99 1 3 with 
High Density PE Foam dielectric, 
stranded center cond. and Duobond 
III Jacket $0.80/ft or $76.00/ 1 00ft 
Also New: 9092, RG8X with Type II Jacket. 

Intro Price $23.00/ 1 00ft 

Call for Specials of the Month 
Full Line of Audio Connectors for torn, 
Kenwood, and Yaesu 
8 Pin Mike Female $2.50 

8 Pin Mike Male Panel $2.50 

1 3 Pin DIN for Kenwood $2.75 
8 Pin DIN for Icom $1.00 

8 Pin DIN for Kenwood $ 1 .50 
Prices Do Not Include Shipping 
Orders 800-783-2666 

Info 301-840-5477 

FAX 301-869-3680 


ANAHEIM WIRE PRODUCTS 



Manufacturer and distributor of 
electrical and electronic wire 
and cable since 1973. 

Items available from our stock: 
Hook up wire, Shrink tubing, 
Cable ties, Connectors. 

Wire cut & strip to specs. 

If interested, please call 
1-800-626-7540 
FAX: 7 1 4-563-8309 
See us on the Internet: 
www.anaheimwire.conn or 
email: info@anaheimwire.com 
Visa/MC/Amex. 


Mfg. Custom Data/Computer Cables 
Network, Coaxial, Fiber Optics 
Wholesale & Retail 

R & D Electronic Supply 

714-979-1834 

3301 S. Harbor #108, Santa Ana, CA 

Visit us a t www.rdelectronic.com 



Miscellaneous 
Electronics For Sale 


OVER 4,300 ITEMS IN STOCK 

Surplus & Refurbished 
Electronic Equipment 
Parts & Accessories 



On Sale Now 

Cordless Telephone Battery Packs 
50 - 75% OFF RETAIL PRICES! 



RS485/422/232/TTL 



Extensive Interface Product Line 


RS232 “Extension Cords” 

Up to 115.2 Kbps, 4000 ft.++ 
Large Multidrop Networks. 
Isolated Units. Smart Units 
Remote Relay “Extension Cords” 


Call the RS485 Wizards at 

( 513 ) 874-4796 


RES= Smith 

www. rs4 8 5 .com 

vW.nutsVolte.coM 


JUNE 2004 


















CLASSIFIEDS 



ONLINE LEARNING 

• For Computer Electronics, Radar, and 
Industrial (Journeyman Exams) 

• Only $49.95 for a hard copy & 1 50 
days of Online Learning 

International Society of Certified Electronics Technicians 
800/946-0201; www.iscet.org 


Software Development Kits 

Include full IDE Compiler ond 
In-Circuit Debugger/Programmer 
Everything you need to get 


irdware only $99 
Other Proto Board Options: 
18F452 18F6720 18F8720 12F675 




262-797-0455 


Misc. Electronics 
Wanted 


Wanted: Balancing machines & 
vibration analyzing equipment 
manufactured by the following: 
•Spectral Dynamics ’Hofmann 
•Bentley Nevada "Schenck *IRD 
Mechanalysis »Gishott 
Contact Mike Park at E.T. 
Balancing, 1 2823 Athens Way, 
Los Angeles, CA 9006 1 
310-538-9738 
FAX: 3 1 0-538-8273 


Affordable Robotics 
Training Courses in: 

Basic Electronics 
Digital Electronics 
Relay Control 
Servo Controllers 
PLC Systems 
Hydraulic Systems 

From Basic to Advanced! 
WWW.UCANDO-CORP.COM 


1-800-678-6113 

FREE SHIPPING! 

UCANDO VCR Educational Products Co. 


Membrane 

Keyboards/Switches 


1 TO 2 WEEKS TURNAROUND 
VERY COMPETITIVE PRICING 

* Ex.: (5) 4-switch keyboards for $396.00 
1 Custom metal bookplates, cases and assemblies 


Tel: (418) 622-5298 

Toll free: 1-888-408-4780 
Email: sales@picofab.net 


Design/Engineering Services 



Product development from concept 
to completed circuit board or 
product. Digital and analog 
xpertise. Microcontroller design for 
Motorola, Intel, Tl ultra low power 
Microcontrollers, 

In-House schematic capture 
and PCB layouts. 


Dave Lancaster 
Infotech Controls 
P.O. Box 2822 
Lower Burrell, PA 15068 
or call (724) 337-8865 
lnfotechcontrols@comcast.net 


Embedded Systems 


LI3-J UiyiluJ Suuiiul 


m LAN A( 




Configure 16 digital I/O or SP1 
Use with parallel & serial devices 
Automatic notifications & e-mails 
Includes S/W and interface board 
For robotics, R&D, data-acq, etc. 

PI 


^Circuit board lai|outs 
*PrototL|pe assemblies 

WWW.OSPREYELECTRONICS.COM 


Your Speaker Source 



FREE CATALOG 

. ::: o 

www.partsexpress.com 


Subscribe today! MMtsfalts.coM 





Create the new Bionic Man! 

The Tetsujin challenge incorporates upcoming technology and ingenuity 
— see Pages 4 and 5 for details! 














NufS&VOLTS 


News Bytes 




Muscle 

Those 

Molecules 

U ndergraduate 
student Eric 
Simone, who 
studies biomedical 
engineering at 
Johns Hopkins 


University, has extended the traditional application of 
molecular manipulation to the micro level — right on a 
computer chip! Because many large molecules are not 
electrically neutral, the resulting surface charge is a type 
of "grab handle" that allows them to be moved via the 
application of an electric field. This process is known as 
electrophoresis and is quite effective on one of the 
largest bio-molecules of current interest — DNA. 

To get an idea of just how large and complex a DNA 
molecule is, consider that a human chromosome 
would stretch to a length of more 
than an inch if the coiling and 
supercoiling were undone. Not 
surprisingly, innovative techniques 
for manipulation are in demand. 

Simone's work extends that 
of assistant professor Jeff Wang 
in arranging chip-based micro- 
electrodes in a unique circular 
design. This performs certain 
bio-analytical applications more 
effectively and could lead to quick, 
inexpensive tests in the near future. 
A drop of liquid containing the DNA 
is simply placed upon the chip and 
the researcher zooms in with a 
microscope to the designated area 
for analysis. 

You can visit Wang's webpage at 

http://pegasus.me.jhu.edu/ 


DOWNLOAD our free CAD software 



02 

DESIGN your two or four layer PC board 


03 

SEND us your design with just a click 


04 

RECEIVE top quality boards in just days 

L 


e^resspcb.com 1 

l«“ 


-thwang/ for more detailed 


information. 


I 1 7,000 Words 

H artford Computer Group, Inc., 
has announced the availability 


of the Argus DC 1730 — the first 
digital camera to retail for under 
$50.00 that includes a full-color LCD 
screen. The DC 1730 is a small, 
lightweight device with VGA 
resolution, a color LCD display, an 
automatic flash, and 8 MB of 
internal memory capable of storing 


JUNE 2004 





N ews Bytes 


up to 117 photos. It has three-in-one functionality for 
digital still, web, and video capabilities. The full-color 
LCD screen built into the camera allows photo reviewing 
and editing, enabling consumers to preview and keep 
only the images they like. This feature — one of the 
key distinguishing attributes between film and 
digital cameras — is absent from other entry-level digital 
cameras. 

The camera is bundled with ArcSoft® 
Photoimpression software for photo editing and 
management and the best thing is 
that you can go out and buy one 
today for about $45.00. 

A Dataport on 
Your Wrist 


developed data service network covers over 100 of the 
largest population centers in the OS and Canada. 
Tentative pricing is either $9.95 per month or $59.00 for 
a full year of service. 

Four Fossil watch styles are available with this 
technology at Fossil stores, leading department stores, 
and on their website at http://abacuswatches.com/ 

Of course, this means it will be harder to escape from 
Email — and after time, this watch may seem more like 
a handcuff than a watch! NV 


Embedded Solutions. 


W hy carry a wireless PDA, 
advanced cell phone, or RIM 



Blackberry when you can sport a 
nifty Fossil watch that keeps you 
plugged in to the world data net? 
Yes, you read that correctly — a 
watch. Enter the Wrist Net™ watch 
for MSN-Direct®. Wrist Net enables 
subscribers to stay connected 
to information by delivering 
personalized news, weather updates, 
stock quotes, personal messages, 
calendar appointments, and more. 

The MSN Direct wireless 
subscription service for Wrist Net is 
configured on the MSN Direct 
website, where people select the 
services and information they would 
like to receive on their watches — 
including news headlines, weather 
updates, personal messages, 

calendar appointments, stock 

quotes, and more. The Microsoft- 


( DozensofEmbeddedCo^ lieiswithCountlessCon^ 




Micro Modules 

► Basic Interpreter 
(on board) 

► Assembly or C 

► Tiny:.85"x2''sq. 

► WeatherProof 

► No Dev. Tools Req. 

► Controllers 

► Data Acquisition 

► ADA, DAC, I/O, RTC, 
LCD, Keypad... 

► Stand Alone 
or Networked 

Starting as Low as 

$29 -single qt) 




f~ aLJ — A 

% 

m 


Communications 

Controller Boards 

Micromint Chips 

► 56k down to 2400 

► Stackable - RTC 

► Basic Interpreter 

baud socket modems 

j i- Backplane - BCC 1 

I On a Chip 

► Conexant Comp. 

i ► Basic Interpreter 

y No Dev Tools Req. 1 

► Caller I.D. 

{ ► Assembly or C 

► X10PLIX Chips 

: Parallel Line 

] > Processor Boards 1 

Serial 

Sensing 

i ► Expansion Boards 

1 Parallel 

► RF Modules -Tiny 

i- Relay Boards 

► 8051 Core 

433 MHz 

i! ► 35"x35" 

j y Low Cost 

900 MHz 

► Custom Configurable 1 

y DIPorPLCC 

► X10PLIX Interface 

► ADA, DAC, Opto 

I ► Floating-Point Math 1 

► RS232 to RS485 

Isolated I/O, RTC, 1 

1 y Commercial or 

Interface 

LCD, Keypad... 

■ Industrial 

Starting as Low as 

Starting as Low as 

I As Low as 

^$39-smg |e qty 

($129 single qtj 

^ $7-lkgtyJ 



Data sheets, Online Ordering and a Complete Catalog o f Products at... 

W www. micromint. corrT ^Su 

Reduce YourTime to Market. 

Minimize your time from conception to production by utilizing one of Micromint's 
market-proven controllers. Whether your concerns are digital or analog, inputs or 
outputs, Micromint has a product to fit your needs. Order quantities of one to 
thousands. Custom design and configurations are available. 

With over 500,000 controllers in the marketplace, Micromint has been providing 
innovative, turn-key solutions to the OEM market for 24 years — from design through 
production, as well as packaging and shipping the final product. Our broad line of 
embedded controllers and turn-key solutions can turn your imagination into reality. 

Micromint 


115 Timberlachen Circle | Lake Mary, FL 32746 | 800-635-3355 | 407-262-0066 | Fax 407-262-0069 


JUNE 2004 



NufS&VOLTS 


Stamp 


by Jon Williams 


Putting the Spotlight on BASIC Stamp Projects, Hints, and Tips 

Stamp Applications 

Drumming Up Control 


Using a Table-Driven Control Model 

L ike most men, I’m not real big on the idea of 
shopping. I know what I want. I want what I want. I 
know where to go get it — and that’s precisely what 
I do: I go get it. Of course, for every rule there is an 
exception and, for my shopping rule, there are two: book 
stores and Tanner Electronics in Dallas, TX. I love going 
to Tanner — even when I don’t need anything specific. Big 
Jim, Jimmy, Jake, Gina, and the rest of the family are 
really lovely people; they always have a smile for their 
customers and are helpful beyond the call of duty. 

One of the many joys of going to Tanner is that 1 
frequently run into BASIC Stamp users and am able to 
chat with them face-to-face. Back in late March, I was in 
Tanner quite often, as I was working on some 
prototypes for a new product. During my visits, I ran 
into quite a few BASIC Stamp users; those collective 


Figure I. Typical traffic lights sequence. 


(too) (ood ) ^ 
(• oo)(ot o) 

^ (too) (too) 

(o oo)(to o) 

-« (ooo) (too) 

— (too) (too) 

74 


meetings drove me to the project we’re going to discuss 
this month. 

The first of those customer meetings was with a man 
who was happy to see BS1 support in the BASIC Stamp 
Windows compiler and asked me to write more about 
the BS1 — especially something that he could work 
through with his son. On another occasion that same 
week, I chatted with two customers who have somewhat 
similar uses for the BASIC Stamp. One of those 
gentlemen is actually a medical doctor who is an avid 
Halloween enthusiast and the second works in the film 
industry as a special effects technician and prop builder. 
Both use the BASIC Stamp as a control element in their 
projects. 

So what can we do with the BS1 that is simple 
enough for a young man, yet useful for the Halloween 
display builder and the professional special effects 
technician? We’re going to build a drum sequencer. Now, 
before you jump on the Internet to Google “drum 
sequencer,” let me warn you that you will be bombarded 
with hits having to do with MIDI music controllers. That’s 
not what we’re doing. 

Our drum sequencer is a simple controller that 
provides cyclical control of multiple outputs; that is, the 
controller will work through a series of control steps and, 
upon reaching the end, will restart the sequence at the 
beginning. There was a time when drum sequencers were, 
in fact, mechanical devices. A rotating drum with contact 
points or cams would provide control outputs to a 
number of circuits. If you’re having a hard time visualizing 
this, just think of a mechanical music box. In a music box, 
we turn a drum to play 
and, at the end of the 
song, it starts over. A 
music box is a type of 
drum sequencer. 

Traffic 
Control 

Let’s look at a real 
life example that is 
useful to explain the 
concept and provide a 
JUNE 2004 





Stamp 




basis for developing our electronic version of this 
controller. Figure 1 shows a series of steps for elementary 
control of the traffic lights at an intersection. This is timed 
control only; there is no provision for external intelligence. 
The following code will illustrate a brute force method of 
providing control: 

Setup : 

DIRS = %00111111 


PINS = *00100001 
PAUSE 10000 
PINS = *00100010 
PAUSE 3000 
PINS = *00100100 
PAUSE 1000 
PINS = *00001100 
PAUSE 10000 
PINS = *00010100 
PAUSE 3000 
PINS = *00100100 
PAUSE 1000 
GOTO Main 

If you connect LEDs to P0-P5 (Figure 2), you’ll see 
that the sequence works just as we expected. That’s great 
if it is all we want to do ... but we’re human and we know 
that someone (maybe us) is going to ask for an 
adjustment or improvement. The first improvement we’ll 
make is to move the output sequence and timing into a 
table. The reason for this is that we can adjust the elements 
of the sequence without digging into the heart of our 
control code. 

Here’s the code for our software-based drum: 

Drum: 

EEPROM (*00100001, 10) 

EEPROM (*00100010, 3) 

EEPROM (*00100100, 1) 

EEPROM (*00001100, 10) 

EEPROM (*00010100, 3) 

EEPROM (*00100100, 1) 

EEPROM (*00100100, 0) 

To make the table easy to read, each step is placed on 
its own line and contains the outputs and timing value (in 
seconds). What you’ll notice is that there is an extra step 
and that the extra step has a timing value of zero. This isn’t 
an operational step, of course; it’s an indicator that we’ve 
reached the end of the table and it’s time to start over. It’s 
logical to use the time field as the end-of-table indicator, as 
there will be other applications for the drum sequencer 
where all outputs are off. 

Now that we’ve created a drum, let’s create the code to 
“turn” it and activate the outputs: 

JUNE 2004 


Reset : 

DIRS = *00111111 
drumPntr = 0 

READ drumPntr, Lights 
drumPntr = drumPntr + 1 
READ drumPntr, stepTime 
drumPntr = drumPntr + 1 
IF stepTime = 0 THEN Reset 
timer = stepTime * StepUnits 
PAUSE timer 
GOTO Main 

At the Reset section, we start by enabling our output 
pins and setting the table pointer to zero. Normally, we 
don’t need to initialize variables to zero because the BASIC 
Stamp does this for us, but, in this program, we will need 
to restart the sequence, so this is a convenient place to put 
that code. 

At Main, the real work gets done. The first READ from 
the table goes directly to the lights without the use of a 
holding variable — this takes advantage of the BASIC 
Stamp architecture and conserves a valuable resource. 


VDEO CAPTURE! 


TRUE FRAME BRE WER FO R MICROS 

-Color & BW up to 640x480 oem(lk) 

t'i;:r;r$27 


J~=$95| 

CHIP COMPUTER 


low cost! 
Perfect for inspection, 
security, robotics. Full 
frame buffer unlike sx, 
pii.usb type. Industry 
std PC104 form factor. 

ov *Vo$25 



STAIVIP DRIVE!! 






NufS&VOLTS 


Stamp 


We’re able to do this by creating the following definition: 
SYMBOL Lights = PINS 

After reading the control output, we must update the 
drum table pointer so that we can get the time for this 
step. READ is used again and the pointer is updated one 
more time so that, the next time through the loop, it will 
be pointing at step outputs. 

Just a moment ago, we discussed using a zero time 
value and an indicator for the end-of-table. So, before 
bothering with timing the outputs, let’s do that check. If 
the time value is zero, the program is routed back to 
Reset and the drum table pointer is reset to zero. By 
setting our end-of-table outputs the same as the previous 
step, there will now be a glitch in the actual outputs as this 
check is taking place. 

When we’re not at the end (time value is greater than 
zero), we will multiply the time by a constant that will be 
useful for PAUSE. Here’s where another design decision 
can make the program more flexible. Instead of 
embedding a “magic number” in the code, we declare a 
symbolic constant for milliseconds. 


Now we’ve got a nice little traffic light simulator that 
we could use to sequence just about anything that will 
accept digital control outputs. For the moment, let’s stick 
with the traffic light simulation and see how we can polish 
it up with the resources we have remaining. 

The first thing that comes to mind is that it would be 
nice to adjust the drum speed without having to crack 
open the code and edit it. If we were using an actual 
mechanical drum, we would adjust its speed with a motor 
controller. We can simulate that in software quite easily. 

By adding the circuit shown in Figure 3, we can read 
the value of a potentiometer using the BSl’s POT 
function. The value returned by POT will range from zero 
to 255 — but let’s add a little bit of design to our speed 
control. Let’s say that we want it to scale the speed from 
25% to 200% of normal. This is actually pretty simple: 
we’ll scale the reading from POT so that it maximizes at 
200 and will not go lower than 25. 

Get_Speed: 

POT Spdlnput , 103, scale 
scale = scale * 69 / 100 + 25 
RETURN 


SYMBOL StepUnitS = 1000 

By doing this, we can adjust the overall time of our 
sequence easily by 
making just one edit. 
This also lets us run 
our sequence in an 
accelerated mode (by 
making StepUnits 
smaller) so that we can 
verify the sequence. 



Figure 4. 74HC595 connections. 



76 


I’ll bet you were expecting to use the MIN and MAX 
operators, weren’t you? So, why didn’t we use them? The 
reason is that using MIN and MAX would have caused 
“dead” zones at either end of the pot’s mechanical range 
— what we want is to use the entire range. Okay, then, how 
did we get there? 

We start by taking the total span of our pot reading — 
256 units — and dividing it into the span of our desired 
output, which is 176 units (200 - 25 + 1). What we end 
up with is 0.686, which we can get very close to by 
multiplying by 69, then dividing by 100. After that, we add 
in the minimum value of our output, which is 25. 

Here’s how the numbers work on the extreme ends of 
the pot’s range: 

0 x 69 = 0 
0 / 100 = 0 
0 + 25 = 25 


255 x 69 = 17,595 

17,595 / 100 = 175 (integer math) 

175 + 25 = 200 

Now that we have a scaling factor (25% to 200%), we 
can add it into the main loop of our program. 

GOSUB Get_Speed 

timer = stepTime * StepUnits / 100 * scale 

If you’re a little new to BASIC Stamp programming, 
you may wonder why we’re dividing by 100 before 
multiplying by our scale factor. Remember that the BASIC 
JUNE 2004 




Stamp 


Stamp uses 16-bit integers and the largest value we can 
have is 65535 — anything greater will cause a roll over 
error and lead to undesirable results. With the code the 
way it is, we can specify step times of up to 30 seconds 
(assuming StepOnits is 1,000) without any timing 
problems. 

Make It Special — Special Effects 

By now, I’m sure we’ve had enough fun with the traffic 
light simulation, so let’s make some adjustments to our 
drum controller so that it better fits the needs of our friends 
who build cool Halloween attractions or movie props and 
special effects. 

The first thing to do is expand the number of outputs 
and it would be nice to do it in a manner that can be 
extended. No problem there; we’ll use our old stand-by 
friend — the 74HC595 shift register. Figure 4 shows the 
connections and — as you can see — there is really noth- 
ing to it. The nice thing about the 74HC595 is that we can 
connect them in a daisy chain mode and get even more 
outputs (using pin 9 of one 74HC595 to feed the Din pin 
of the next). For the moment, let’s just stick with one 
device for eight outputs. 

The 74HC595 is a synchronous serial device, but the 
BS1 doesn’t have the SHIFTOCIT instruction that is very 
popular with the BS2 family. Of course, this is not a big 
problem; we’ll simply write a bit of code to take care of that 
function for us. 

Shif t_Out : 

FOR idx = 1 TO 8 
Dpin = dataMsb 
FULSOUT Clock, 1 
dOut = dOut * 2 


PULSOUT Latch, 1 
RETURN 


This code is very simple, but there is a bit of hidden 
complexity that I want to reveal. This complexity has to do 
with the way that we declare variables for the BS1. You 
may have noticed that, in some of my other programs, I 
start my variable definitions with B2, leaving BO and B1 
free. There is a very specific reason for this. The reason is 
that BO and B1 are the only BS1 variables that are 
bit-addressable, so I make it a habit to reserve these, in 
case I need to do something bit-oriented, as is required by 
the Shift_Out code. 

With that, let’s look at the variable declarations that 
allow the Shift_Out subroutine to work. 

SYMBOL dOut = BO 

SYMBOL dataMSB | BIT7 

The variable called dOut is what we’ll use to update 
JUNE 2004 


the outputs (it will be destroyed in the process, so it’s 
temporary). The variable dataMSB is BIT7 of the RAM 
memory map and, by our previous definition, the MSB of 
dOut. 

Getting back to the Shift_Out code, we can see that 
it’s just a simple loop that will handle eight bits. That 
makes sense, right? Inside the loop, the routine places the 
MSB of dOut onto the data pin of the 74HC595. Pulsing 
the clock line (low-high-low) causes the bit to be moved 
into the 74HC595. The next step is to shift the bits of 
dOut left so that we have a new MSB. This is done by 
multiplying dOut by two. After all of the bits are moved into 
the 74HC595, we need to move the bits to the outputs. 
This is done by pulsing the Latch line. 

Now, some of you may be thinking that, with all that 
work, it must take forever to update the outputs. It doesn’t. 
I put the subroutine into a counter loop and found that, 
even with the “old” BS1, the 74HC595 outputs can be 
updated about 20 times per second — much faster than we 
will ever need in this kind of application. 

The next upgrade to our controller is a trick 1 learned 
long ago when working in the irrigation industry, building 
sprinkler controllers. We’re going to apply a bit of encoding 
to the time field so that we can have more flexibility on that 
end. In our original design — with everything set at 100% 



VERSION 


PCB123 Provides the 
Complete Circuit Board Solution, 
Design Through Order 


PCB123 is a FREE layout and schematic design software 
tool that quotes your board while you design! 

-> Import Net lists from multiple CAD vendors 
-» 145,000+ parts library 
-> 2, 4, and 6 layer support 

I -> Fast, accurate DRC 

Copper pour with net connectivity 
Fine pitch autorouter with fanout 


77 




Nuts ~& Volts 


Stamp 


— we can get step 
durations up to 25 
seconds. Maybe we 
have a holiday 
lighting display that 
needs a step output 
longer than this. 

Here’s the trick: 
We’re going to use 
bit 7 of the time 
field as a multiplier 
(something other 
than the two it is 
now, that is). In this 
version of the 
program, bit 7 will 
tell the program to multiply the time value by 10, so now 
we have two ranges: 0.1 to 12.7 seconds per step in 0.1 
second increments and 1 to 127 seconds in one second 
increments. Take a look at this drum table: 

Drum: 

EEPROM (%10000001, %00000101) 

EEPROM (%01000010, %00001010) 

EEPROM (%00100100, %10000010) 

EEPROM (%00011000, %10000011) 

EEPROM (%00000000, 0) 

The first two steps have bit 7 of the time field clear, so 
these steps will run in increments of 0.1 seconds. In this 
case, step 0 will run for 0.5 seconds and step 1 will run for 
one second. Steps 2 and 3 have bit 7 set, so the multiplier 
(xlO) will be used. This means that step 2 will run for two 
seconds and step 3 will run for three seconds. Let’s have a 
look at the code that takes care of this: 


Step_Timer: 

timer = stepTime & %0111111 
IF longStep = No THEN Timer_Loop 
timer = timer * Multiplier 

Timer_Loop : 

POT Spdlnput , 103, delay- 
delay = delay * 69 / 100 + 25 
FOR idx = 1 TO timer 

PAUSE delay 
NEXT 
RETURN 

To make things convenient, the timing code has been 
moved into a subroutine. At the top of this code, we’ll 
move the base step time to timer — without the multiplier 
bit. Then, we can check the multiplier bit (alias longStep) 
and, if it is clear (0), we will jump right to the timing loop, 
otherwise we will apply the multiplier to our base time. 

After that, we move into the timing section, which 
starts by reading the pot input. To keep things clean, the 
potentiometer is read and provides direct timing instead of 
an adjustment factor, as we did in the final version of the 
traffic light simulation. The last step is to use the timer as 
a loop control to create the step timing. The advantage of 
this method is that the maximum PAUSE duration will be 
200 milliseconds (read and scaled from the potentiometer 
input), so, if we want to interrupt the cycle with some sort of 
override, we don’t have to wait for the entire step to time out. 
By inserting an “escape route” in the final timing loop, we will 
only ever have to wait 200 milliseconds to interrupt a step. 

All right, let’s just add one more feature to our 
controller before wrapping up, shall we? Since we’re now 
using the 74HC595 to handle the outputs, we have some 



eaaaa mmm 

Easy Step'n 

• For the experimenter. 

• Determine surplus stepper motor specs using 

simple easy to build test equipment. 

• Design and build microcontroller-based control systems 

(flow charts and code examples included). 

• Design and build stepper motor driver circuits. 

• Analyze the mechanical characteristics of stepper motor- 

driven devices. 

• The book is full of experiments, circuits and code. $34.95 

Table Of Contents And Ordering Information On Web Site 


Microcontroller Books 


L SQUAKS d i 

I P.O. Box 1414, Hayden, I 

I Voice (208) 664-4115 Fax i 

B the day w^receivey our" o'Jde l or the ne rt I 

« ■ ■ ft. , u u i 



New Titles 
Same Useful 
Books 

Table Of Contents And Ordering 
Information On Web Site. 

Not Distributed Via Book Sellers 

We accept VISA, MC, AM, DS, MO, Check 
CA residents please add 7.25% CA sales ta> 


Easy Microcontrol'n - Beginner $29-95 

• Programming Techniques 

Instruction set, addressing modes, bit manipulation, 
subroutines, loops, lookup tables, interrupts 

• Using a text editor, using an assembler, using MPLAB 

• Timing and counting (timer 0), interfacing, I/O conversion 

Microcontrol'n Apps - Intermediate $44.95 

• Serial communication - PICmicro to peripheral chips 

• Serial EEPROMS 

• LCD interface and scanning keypads 

• D/A and A/D conversion - several methods 

• Math routines 

• 8-pin PICmicros 

• Talking to a PICmicro with a PC using a terminal program 

• Test equipment and data logger experiments 

Time'n and Count'n - Intermediate $34.95 

• 1 6-bit timing and counting applications 

• Timer 1 , timer 2 and the capture/compare/PWM (CCP) 
module 

Serial Communications - Advanced $49.95 

• Synchronous - bit-bang, on-chip UART, RS-232 

• Asynchronous - I2C (Philips Semiconductors) 

SPI (Motorola), Microwire (National Semiconductor) 

• Dallas Semiconductor 1-Wire bus 



Stamp 


free I/O pins on the BS1. It seems to me that the ability to 
add a single-step mode to the controller would be useful. 
This could be used to check the output sequence or for 
manual control when step timing is variable (as when 
operating a prop or film effect). 

By using the switch and pushbutton inputs shown in 
Figure 5, we can add the single-step feature to the 
controller. The switch will serve as our Mode input: open (P5 
will be pulled high) means that we’re going to run using 
timed steps; closed (P5 will be pulled low) means that the 
Step button will be used to manually advance the sequence. 

READ drumPntr, stepOuts 
drumPntr = drumPntr + 1 
READ drumPntr, stepTime 
drumPntr = drumPntr + 1 
IF stepTime = 0 THEN Reset 
dOut = stepOuts 
GOSUB Shift_Out 

Check_Mode : 

IF Mode = MdTimer THEN Timed_Step 
Force_Release : 

IF Advance = Pressed THEN Force_Release 
Wait_For_Press : 

IF Advance = NotPressed THEN Wait_For_Press 
GOTO Main 

Timed_Step : 

GOSUB Step_Timer 
GOTO Main 


Even adding the timed versus single-step option 
doesn’t complicate our program at all. After updating the 
outputs with the current step data, the program checks the 
state of the mode switch. If open, it jumps to Timed_Step, 
which, in turn, calls the Step_Timer subroutine. 
(Remember that PBASIC in the BS1 is very close to 
assembly language in many respects, so there is no 
IF-THEN-ELSE and we can only branch with IF-THEN.) 

When the Mode switch is closed (single-step mode 
selected), the program will examine the state of the step 
button (the input is called Advance in the program). The 
first thing it does is make sure that it’s not already pressed. 
This was a design decision I made so that each step 
requires a separate button press and release. You can elim- 
inate this if you like, but you may find that a small PACISE 
is required between steps because, without it, a simple but- 
ton press may result in the execution of several steps. 

Once we know the button is clear, we wait for it to 
close and, when it does, the program branches back to 
Main, where we execute the next step. Pretty easy, isn’t 
it? Yet it is a very cool and useful project for many 
applications. Another option we could add to the program 
is the ability to single-shot a timed sequence, but, alas, 
we’re out of space, so I will leave that to you. Of course, if 
you need to do that and can’t figure it out, you can always 
send me a note. 

Have fun, and until next time — Happy Stamping. NV 


Jon Williams 

iliams@parallax.cc 

Parallax, Inc. 



Digital Oscilloscope Logic Analyzer 


Bitscopc 


Convert your PC into a powerful Scope and Logic Analyzer! 

Now you can analyze electronic circuits in the analog and digital domains at the same time. 
BitScope lets you see both analog AND digital logic signals to find those elusive bugs. USB and 
Ethernet connectivity means you can take BitScope anywhere there is a PC or Network. 

BitScope Hardware BitScope Software Applications 

Is Sample Rate 


www.bitscope.com 


JUNE 2004 


79 






Nuts & Volts 


Open Communication 


by Louis E. Frenzel 


The Latest in Networking and Wireless Technologies 

Open Communication 

Spread Spectrum Radio: How It Works in 
CDMA Cell Phones 


D espite the fact that spread 
spectrum (SS) technology 
is very widely used in every 
day wireless applications, few people 
— including technical types — 
actually know how it or its CDMA 
derivative works. It is one of the 
more complex wireless methods, but 
it has some really great benefits. 
With over 70% of US cell phones 
using this method, chances are you 
use a CDMA cell phone. Here is an 
introduction to this killer wireless 
technology. 

Narrowband vs. 
Wideband 

Because the electromagnetic 
spectrum is so precious and limited, 
radio applications have always been 
developed in a way that minimizes 
the amount of bandwidth used. The 
modulation method has a great deal 
to do with how much spectrum 
space an application uses. Much has 


been done to use modulation 
methods that reduce the amount of 
bandwidth needed to the very 
minimum. So, we are used to 
thinking of wireless signals occupying 
very narrow bands or channels. 

In transmitting digital data, we 
are also concerned about channel 
bandwidth. It always takes more 
bandwidth to transmit digital data 
than it does for analog signals, like 
voice. A typical rule of thumb is that 
you can usually transmit data at a 
rate of one bit per Hertz of bandwidth 
(bits/Hz) meaning that a 1 Mbps 
data rate and can be transmitted in a 
1 MHz bandwidth channel. 
Other methods have been developed 
to transmit more bits per Hz, 
thereby improving the bandwidth 
efficiency. So, we have again gotten 
accustomed to seeking ways to cram 
more data at higher speeds into 
narrow channels and we have done a 
good job of this, in general. 

There is, however, another 


method that goes against that princi- 
ple. Known as spread spectrum or 
SS, it takes a signal and spreads it 
out over a very wide bandwidth. In 
fact, the bandwidth actually exceeds 
the data rate by 100 times or more in 
some applications. By doing that, we 
get some excellent benefits. 

For example, we get security of 
transmission. The process of 
spreading the information to be 
transmitted over a wide bandwidth 
adds some special coding that is 
difficult for others to copy and recover. 
It actually just appears to be noise to 
a standard narrowband receiver. 

Second, SS signals are also jam 
proof. Jammers usually operate on a 
single frequency and thus do not 
typically harm SS signals. The security 
and anti-jamming features make SS 
very appealing to the military. 

Third, SS gives some relief from 
the multipath problem that plagues 
most wireless applications. In many 
high frequency radio uses, the signal 
is reflected, refracted, diffused, and 
otherwise misdirected as it travels 
from the transmitter to the receiver. 
The result is that the receiver actually 
receives several versions of the same 
signal at different times as they are 
delayed over the different paths. This 
usually causes fading and signal 
cancellation. When you use SS, the 
system is more tolerant of different 
signal arrival times and special 
receiver techniques make it possible 
to use all received signals to boost 
overall strength. 

A huge advantage of SS is that it 
allows many signals to occupy the 
same bandwidth simultaneously 
JUNE 2004 



80 



Open Communication 


without interfering with one another. 
For that reason, it is inherently a 
multiplexing or multiple access 
method that permits many signals to 
share common spectrum. 

Spread spectrum is a technique 
for digital communications. It was 
developed about the time of World 
War II. The military has used SS for 
many years. Its use in commercial 
applications was non-existent because 
of its high cost and complexity — until 
the past decade. Today, thanks to 
amazing technological developments 
and integrated circuits, SS is just as 
practical as most other older and less 
complex narrowband methods. 

SS is widely used with cell 
phones. In this application, it is called 
code division multiple access or 
CDMA. It is also the dominant 
technology used in the highly popular 
802.11b Wi-Fi wireless local area 
networks (WLANs). In this article, I 
will focus on how CDMA cell phones 
work. 

The Principles of 
Spread Spectrum 

There are two basic ways of 
creating spread spectrum: frequency 
hopping (FH) and direct sequence 
(DS). Both are widely used, but 
DS is probably the most common 
and, therefore, the one that will be 
detailed here. Just to be complete, 
though, here is a quickie overview of 
FHSS. 

FHSS is a technique that takes 
the digital data to be transmitted, 
divides it up, and transmits it in 
segments — each segment on a 
different frequency. The transmitter is 
designed to randomly hop from one 
frequency to another. The transmitter 
dwells on that frequency for a short 
time, during which a portion of the 
data is transmitted. For example, in 
the popular Bluetooth wireless 
personal area networking (PAN) 
system, the hop rate is 1,600 hops 
per second over 79 randomly selected 
hop frequencies in the 2.402 to 2.480 
GHz range. That means that the dwell 
time on each frequency is 1/1,600 or 
JUNE 2004 


625 g.S. During each dwell period, 
data is transmitted at a rate of 1 
Mbps. 

The frequency of transmission is 
chosen by a pseudo random code 
generator that produces an arbitrary 
binary code that, in turn, selects the 
transmit frequency in a phase-locked 
loop (PLL) frequency synthesizer. 
The term “pseudo random” means 
that the code is not perfectly random. 
Gaussian or "white" noise is 
completely random, while pseudo 
random noise has only partial 
randomness. Still, pseudo random 
noise is random enough for this 
application; its code is random, yet it 
does repeat after many iterations. To 
recover the signal, obviously the 
receiver must have the same pseudo 
random code so that it can hop from 
one frequency to the next in the same 
pattern or sequence. 

As you can see, the information 
really is spread over a huge bandwidth, 
in this case almost 80 MHz. That is 
very wide for just a 1 Mbps data rate. 
The advantage is that a signal like 
this just looks like random noise to 
any other receiver. Any receiver that 
does not hop in the same frequency 
pattern cannot retrieve the signal, so 
it, too, only appears to be noise. 
Furthermore, many signals can use 
the same bandwidth at the same time 
and be almost totally invisible to one 
another because their hop patterns 
are different. 

Direct sequence spread spectrum 
(DSSS) — the more common type — 
takes the serial digital data to be 
transmitted and combines it with a 
higher frequency serial pseudo 
random code signal in an exclusive 
OR (XOR) circuit (Figure 1). The 
result is that the spread output is at 
the higher frequency. The lower rate 
data signal is converted to a higher 
frequency serial data signal, which, of 
course, occupies a much greater 
bandwidth (Figure 2). Therefore, the 
signal is spread. 

The higher frequency code is 
called a chipping code and one bit 
time is the chip time. The reciprocal 
of the chip time is the chipping rate. 


Amazing Devices 


Anti Gravity Projects 

All new mini 35 kv 1.5 
ma adjustable output 
power supply with 
instructions on making 
a simple craft. 

GRAIKKit $69.95 

GRA10 Assembled $119.95 



Green Lasers Pointers 

with Coliminator 



1 0,000 feet plus - Full 5 mw. A real 
beauty!! 

LAPNGR5 Ready to use.. .$129.95 


30 Inch Spark 
Tesla Coil 

Light weight table top unit 
is only 35 lbs with air 
cooled two point spark j 
gap. For 110 or 220 
operation. 


BTC4K Kit $899.95 

BTC40Assmbld $1199.95 

BTC3K Kit lOinch spark .. $349.95 


Phaser Pain Field Pistol 

Experimental device for 
animal control. Variable 
and complex output over 
130db. Do not point at 
people! Higher powered 
and rental units available. 

PPP1K Kit $59.95 

PPP10 Assembled $84.95 



Burning Laser Ray Gun 

Uses our sealed 
C0 2 laser tube and 
high efficiency 
current source to 
generate a continous beam capable of 
lighting fires over distances. Operates 
12 vdc with optional inverterfor field or 
115vacforlab use. 

LABURN1 Plans $20.00 

(all parts available) 


Information Unlimited 

Box 716, Amherst, NH 03031 USA 
Orders: 1-800-221-1705 
Fax: 1-603-672-5406 
Email: riannini@metro2000.net 
Catalog $2.00 



siiOAlsiON 


Open Communication 


The chipping rate defines the 
bandwidth of the signal. The coded 
signal is applied to the modulator 
along with the carrier signal. Binary 
phase shift keying (BPSK), quadrature 
phase shift keying (QPSK), or some 
variation thereof is normally used. 
The modulator output signal is 
amplified in the transmitter before 
being applied to the antenna. 

Many individually coded signals 
may occupy the same bandwidth at 
the same time without interfering 
with one another. The method of 
distinguishing one signal from 
another is by the unique chipping 
code assigned to it. 

For example, if the pseudo 
random code generator generates an 
eight-bit code, there are theoretically 
2 8 = 256 possible different codes. 
Each transmitter and receiver is 
assigned a specific code. The 
receiver is capable of recognizing 
only this code. All other codes are 
not recognized, so the signals just 
appear to be noise. The codes serve 
the purpose of “channelizing” the 


shared common band. 

Figure 3 shows the receiver. 
The signal from the antenna is 
usually downconverted in the usual 
superheterodyne process to an 
intermediate frequency (IF) or, in 
some cases, directly to the baseband 
modulating signal. The carrier and 
pseudo random code signal are then 
combined in a mixer to produce a 
signal similar to the IF signal 
containing the data. The correlator 
then compares the received code 
with its assigned channel code. If the 
codes do not match, the output is 
essentially zero — actually some 
noise. If the codes do match, the 
data is then recovered. 

CDMA 

One of the biggest problems that 
cellular carriers have had over the 
years is providing increasing capacity 
on their systems. The popularity of 
cell phones essentially overwhelmed 
most wireless carriers. The number 
of subscribers quickly exceeded the 


Figure 2. The transmitter signals show the serial data to be transmitted, the pseudo 
random chipping code, and the spread signal at the XOR output. 


Serial digital data (A) 


Pseudo random chipping code (B) 



Spread signal (C) 


Chipping period 


82 


capacity of the cellular network 
to handle them. The early first 
generation analog (Advanced Mobile 
Phone System or AMPS) system had 
832 30-kHz wide channels for both 
sending and receiving. Once all of 
the channels had calls on them, new 
callers were blocked until one of the 
channels was released. 

With new spectrum space overly 
expensive or difficult — and, in some 
cases, impossible — to come by, the 
carriers quickly adopted second 
generation (2G) digital methods. The 
most popular was one that used the 
same 832 available channels, but 
introduced a time division multiplexing 
(TDM) scheme that effectively gave 
three more voice calls per channel. 
Known as time division multiple 
access (TDM A), this standard — 
referred to as IS-136 — quickly 
became the most popular system. 

A European-developed TDMA 
system is called Global System for 
Mobile communications or GSM. It is 
the most widely used 2G digital system 
in the world and its use is growing in 
the US. Unlike IS-136 TDMA, it 
uses 200 kHz wide channels and 
multiplexes eight calls per channel. 

During that same time, CDMA 
became feasible, thanks to the 
pioneering SS company Qualcomm 
out of San Diego, CA. They patented 
many of the newer methods and 
developed IC chipsets to make 
CDMA handsets. In doing this, they 
solved all of the difficult technical 
problems that — up to that time — 
had prevented CDMA from 
participating in the cellular market. 

CDMA uses the spectrum 
differently than AMPS and TDMA. It 
actually uses 1.25 MHz wide channels, 
as opposed to the 30 kHz channels 
of IS-136 or the 200 kHz channels of 
GSM. However, it can accommodate 
as many as 55 callers simultaneously 
in that bandwidth. Thus, CDMA not 
only permitted increased capacity 
for cellular carriers to make more 
money, but the SS techniques also 
made cellular wireless more reliable 
and resistant to the fading and 
multipath conditions so inherent in 
JUNE 2004 




Open Communication 


cell calls. 

The big question is, how does this 
method permit that many signals to 
use the same frequency range 
without them interfering with one 
another? The answer lies in the name 
— code division multiple access. It 
uses different binary codes assigned 
to each user to separate them. Here’s 
how it is done. 

First, the voice to be transmitted 
is converted into a serial binary signal 
with an analog-to-digital converter 
(ADC). Recall that, to digitize an 
analog signal, it has to be sampled at 
a rate at least twice the highest 
frequency in the signal. For voice, we 
normally assume 4 kHz as the upper 
limit, as this gives excellent frequency 
response, quality, and intelligibility. It 
also means that the sampling rate 
must be at least 8 kHz or every 125 
pS. If we use an eight-bit ADC, then 
serialize the resulting signal, we end 
up with a digital voice signal that 
varies at an 8 x 8 kHz = 64 kbps rate. 
Such a signal won’t even fit in one of 
the older 30 kHz bands. 

To significantly reduce this rate, 
the digitized voice signal is put 
through a vocoder. This is a digital 
circuit or embedded microprocessor 
that uses a special algorithm to 
compress the signal creating a new 
serial voice signal at a lower rate. 
There are many different types of 
vocoders, some with a serial output 
as low as 7 kbps and as high as 13 
kbps. In CDMA systems, the rate is 
8.6 kbps. 

After adding CRC error detection 
and other bits, the data rate is 
increased to 9.6 kbps and this is what 
is transmitted. At the receiver, the 
compressed signal is decompressed 
by the vocoder before it is applied to 
a digital-to-analog converter (DAC) 
so that it can be heard. 

Next, the serial digital voice 
signal is encoded and spread. This is 
done by feeding it to an exclusive OR 
(XOR) gate along with a high 
frequency spreading or chipping 
signal. This binary signal has a 
frequency about 100 times the digital 
voice signal. In CDMA, the chipping 
JUNE 2004 


signal is 1 .2288 MHz. The XOR output 
is at that rate, but is now encoded. 
This signal is then fed to the modulator 
on the transmitter. QPSK is the 
modulation forward channel from the 
base station to the mobile. Offset 
QPSK is used in the reverse channel 
from the handset to the basestation. 

The overall system is way too 
complex to describe here and the 
above description is an overly 
simplified one, but should provide the 
basic idea. The main point is that the 
spreading is done by a 64-bit channel 
code that identifies the signal. These 
64-bit codes — called Walsh codes — 
have been carefully selected so that 
they are what we call orthogonal to 
one another. 

What this means is that, when 
any two of the codes are compared to 
one another in a correlation process 
in the receiver, the output will be zero 
(binary 0). The output will be one 
(binary 1 ) if the received code corre- 
lates 100% with the receiver code. 

Another important and unique 
feature of CDMA receivers is a 
tapped delay line. The delay line 
introduces a short time delay, in even 
increments, to the received signals. 


The signals may be tapped off at 
any increment. The output of each 
increment is considered to be one 
finger or tine of a rake, so the 
receivers using this technique are 
referred to as RAKE receivers. 

What the RAKE receiver does is 
to compensate for multipath delays. 
A signal that has been delayed in 
transmission will be received and 
processed by the receiver. The RAKE 
receiver takes the delayed signal off 
at the proper point on the delay line 
so that it lines up with the main 
received signal. The outcome is that 
more received signals are added 
together coherently to produce a 
stronger, more reliable signal. 

There are 64 Walsh codes and 55 
of them are used for regular voice 
traffic in one of the 1.25 MHz bands. 
The other nine channels are used for 
pilot, synchronization, and paging 
signals that the base station and 
handset use to communicate and 
synchronize with one another so that 
a call can be set up. 

Synchronization is particularly 
important for making CDMA work. 
CDMA base stations actually use a 
GPS (Global Positioning System) 


Figure 3. A simplified block diagram of a spread spectrum receiver. The mixer modulates 
the internal pseudo random code onto an IF carrier so it can be compared to the 
received data at the same frequency in the correlator. 


Antenna 



83 




siiOAlsiON 


Open Communication 


satellite receiver to pick up the timing 
signals from the GPS satellites. Each 
satellite contains a rubidium atomic 
clock that is supremely accurate and 
precise. It is this timing signal that 
times and syncs all digital signals in a 
CDMA system. 

A key component of the CDMA 
cell phone system is automatic power 
control. CDMA only works reliably if 
the power levels of all received signals 
at the base station are the same or 
nearly so. In the real world, the 
received power levels can vary widely, 
depending on the distance the handset 
is from the basestation, whether it is 
indoors or outdoors, what physical 
obstructions are close by and all sorts 
of other conditions. Nearby handsets 


For More Information on 
Spread Spectrum 


Here are two websites where you can 
find out more than you want or need to 
know about spread spectrum and 
CDMA: 

PaloWireless Resource Center 

www.palowireless.com 

Spread Spectrum Scene Magazine 

www.sss-mag.com 


will produce a strong signal and those 
at the outer reaches of the cell site will 
produce a weak signal. 

With such a wide variation, the 
receiver has a tough time distinguishing 
between the signals. The CDMA 
system overcomes this problem by 
providing an automatic power control 
mechanism. The base station assesses 
the level of the received signal and 
provides feedback to the handset by 
way of an 800 bps power control 
signal. It tells the handset to increase 
or decrease transmitter power. All this 
is done automatically and results in a 
flattening or evening out of all the 
signal levels. 

CDMA Standards 

The CDMA system we have been 
talking about is an industry standard 
set by the Telecommunications 
Industry Association and the 

Electronics Industry Association 
(TIA/EIA) and is known by its 
designation IS-95. It was established 
in 1993. Newer versions — such as 
IS-95A and IS-95B — provided a data 
transmission capability of 14.4 kbps 
and other features. Sometimes, you 
will hear the IS-95 standard referred 
to as cdmaOne, which is 



Qualcomm’s name for it. 

A newer version is cdma2000, 
developed by Qualcomm. It is 
backward compatible with dmaOne, 
but provides high speed packet data 
transmission capability, as well as 
increased voice capacity. This new 
version of CDMA doubles the 
number of voice channels available. 
It uses 128 64-bit Walsh codes, but 
the bandwidth remains the same at 
1.25 MHz. 

The first version of cdma2000 — 
called lx — has a packet data 
transmission capability for Email and 
Internet access. The maximum data 
rate is 153 kbps, but, in practice, the 
actual rate is less. The lxEV-DO 
version of cdma2000 features a packet 
data rate up to 2.48 Mbps. A newer 
version — yet to be deployed — is 
lxEV-DV, which gives an even higher 
rate of 3.09 Mbps. This will permit 
CDMA cell phones to receive video. 

Already, the lx versions are 
widely used to transmit digital photos 
from the digital camera built into 
many of the newer phones. Finally, 
there is a version of cdma2000 called 
3x that uses three 1.25 MHz channels 
and a kicked up chip rate of 3.684 M 
chips per second to get even higher 
data rates at the expense of spectrum 
space. 

The cdma2000 system is also 
a recognized standard by the 
International Telecommunications 
Union (ITU). It is one of several other 
so-called third generation (3G) cell 
phone technologies. Another version 
— known as wideband CDMA or 
WCDMA — uses 5 MHz wide bands 
and a 4.096 M chip per second rate to 
give very reliable data transmission 
rates up to 2 Mbps. WCDMA is 
just now coming on line in Europe 
and Asia, but is not yet available in 
the US. 

However, cdma2000 is very widely 
available, especially in lx format. In 
fact, the most widespread cell phone 
technology in the US is CDMA, with 
about 70% of the market share. If 
your carrier is Verizon or Sprint, 
chances are you have a CDMA 
phone. NV 


JUNE. 2004 







by Jeff Eckert 


TechKnowledgey 2004 


TechKnowledgey 


2004 


Events, Advances, and News 
From the Electronics World 


Advanced 

Technologies 

Electricity from Sewage 



I f some environmental engineers at 
Penn State University ( www. 
psu.edu) have their way, sewage 
treatment and power generation will 
someday be integrated into a single 
process. This will be made possible by 
their microbial fuel cell (MFC), which 
works through the action of bacteria 
passing electrons to an anode (the 
negative electrode of a fuel cell). 

Microbial fuel cells work through 
bacterial actions that pass electrons 
to an anode (negative electrode of a 
fuel cell). The electrons flow from the 
anode through a wire, producing a 
current, to a cathode, where they 
combine with hydrogen ions (protons) 
and oxygen to form water. 

So far, experiments have shown 
that the device is capable of generating 
between 10 and 50 mW per square 


meter of electrode surface while 
removing up to 78% of the organic 
matter, as measured in terms of 
biochemical oxygen demand (BOD). 

Other researchers have shown 
that MFCs can be used to produce 
electricity from water containing pure 
chemicals, such as glucose, acetate, or 
lactate. So far, the Penn State 
researchers are the only ones to show 
that MFCs can produce electricity 
directly from wastewater skimmed from 
the settling pond of a treatment plant. 

Logan notes that, in MFCs 
currently under investigation in other 
laboratories, various kinds of bacteria 
are typically added to the system. 
However, in the Penn State approach, 
no special bacteria are added. The 
naturally occurring bacteria in 
wastewater drive power production. In 
addition, a reaction (oxidation) that 
occurs in the interior of the bacterial 
cell lowers the biochemical oxygen 
demand, cleaning the water. 

The current Penn State MFC is 
about 6 inches (15 cm) long and 2.5 
inches (6.5 cm) in diameter. It 
contains eight anodes — composed of 
graphite — that supply about 36 square 
inches of surface area for the bacteria 
can adhere to and pass electrons. 
The cathode is a carbon/platinum 
catalyst/proton exchange membrane 
fused to a plastic support tube. 

According to Project Director Dr. 
Bruce E. Logan, "MFCs may represent 
a completely new approach to waste- 
water treatment. If power generation in 
these systems can be increased, MFC 
technology may provide a new method 
to offset wastewater treatment plant 
operating costs, making advanced 
wastewater treatment more affordable 
for both developing and industrialized 
nations .... I'm optimistic that MFCs 


may be able to help reduce the $25 
billion annual cost of wastewater treat- 
ment in the US and provide access to 
sanitation technologies to countries 
throughout the world." 

Prototype PCB Offers 2.5 
GHz Rate 

A s processor clock rates have 
increased, the performance of 
printed circuit boards has become a 
major bottleneck that restricts high 
speed data transmission in broadband 
communication systems. At present, 
PCB traces generally limit signals to 
about 800 MHz. In response, Taiwan's 
Electronics Research & Service 
Organization (ERSO), a part of the 
Industrial Technology Research 
Institute (ITRI, www.itri.orq.tw) , has 
developed the Electro-Optical Printed 
Circuit Board (EO-PCB), key compo- 
nents of which are flexible organic opti- 
cal waveguide film that can be laminat- 
ed onto printed circuit boards and a 
90° reflecting mirror. After lamination, 
optoelectronic devices and their 
driving devices are assembled and 
integrated on the circuit board. 

The result is an optical 
transmission system that is far superior 
in short distance, high speed transmis- 
sion. The prototype has been shown 
by a standard eye diagram test to 
reach a 2.5 GHz transmission rate 
and thus it can meet the challenge of 
the next generation in high speed 
communication. In addition, it has 
many desirable merits, such as high 
density, multiple loops, high integration, 
and suitability for volume production. 

In a recent exhibition, ERSO 
displayed a system consisting of two 
computers with built-in 1 Gbps 
network interfaces. Each computer 


JUNE 2004 


85 



NUTS&VOLTS 


TechKnowledgey 2004 


served simultaneously as the signal 
receiving and sending counterpart 
for the other. First, an electro-optical 
transceiver module in one of the 
computers would convert the electric 
signals of the network card into optical 
signals, which were then transmitted 
through the waveguide on the 
electro-optical printed circuit board. 

After reaching the other end, the 
optical signals were converted back 
to electric signals by an optical-electro 
module and then processed by the 
network card. Through this framework, 
a two-way, high speed data exchanging 
mechanism was achieved. 


Computers and Networking 
Sun Offers Low Cost 
Alternative 



The Sun Blade 1 50 offers an affordable 
alternative to both the Windows® and 
MacOS® worlds. 

Courtesy of Sun Microsystems. 


I t's no secret that most of the world 
— at least in terms of desktop and 
mobile computers — operates in 
the Windows domain. We often think 
of the Mac OS as the alternative for 
individuals who have not been 
assimilated by Microsoft, but there is, 
in fact, another choice. Once associ- 
ated only with prohibitively expensive 
minicomputers, Sun Microsystems 
now offers some entry level machines 
that are price-competitive with some 
of the more popular desktop systems. 

For example, the Sun Blade 1 50 
is a 64-bit workstation that is powered 
by a 550 MHz or 650 MHz UltraSPARC 
Ili CPU and it comes with up to 2 GB 

86 


of RAM, a range of graphics options, 
and up to two 80-GB hard drives. It is 
geared for use in e-commerce, software 
development, technical applications, 
business financial operations, and 
technical applications. Target 
industries include education, financial 
services, health care, government, 
publishing, and telecommunications. 

The Sun Blade 150 comes with 
Sun's Solaris 8 and 9 operating 
systems and an optional coprocessor 
card that allows you to run Windows 
software at native speeds alongside 
Solaris applications. The best part is 
that the list price starts at $1,395.00. 
If money is not a factor, you can 
move up to the dual-processor Sun 
Blade 2500, which starts at 
$4,995.00. Details are available at 
www.sun.com 

Free Email Provides I GB 
Storage 

B y the time you read this, 
Google's new "Gmail" service 
should be available. According to the 
company, "Unlike other free webmail 
services, Gmail is built on the idea 
that users should never have to file or 
delete a message or struggle to find 
an Email they've sent or received." 

Accordingly, each user is allocated 
up to 1 GB of storage space, which is 
roughly equivalent to 50,000,000 
pages of Email. Gmail also offers a 
built-in search capability so you can 
look for keywords within every message 
you have ever sent or received, plus 
spam protection. Details are available 
at http://gmail.google.com 

This sounds like such a great 
offer that a pessimist might believe 
that there must be a catch and, of 
course, there is. All of your incoming 
Email will be scanned, the content 
will be evaluated, and related 
advertisements will be inserted into the 
message. This may not be particularly 
objectionable, but it has been observed 
that there is nothing to keep Google 
from correlating data from Emails and 
its search site to create detailed user 
profiles that could be misused. 

Also, your messages — even if 


deleted — may still be stored in the 
system long after you have closed 
the account. These considerations 
have brought a coalition of 28 privacy 
and civil liberties groups to urge 
Google to rethink the idea. According 
to Maurice Wessling of the Bits of 
Freedom (www.bof.nl) organization, 
"The mail is not just being scanned. 
It's being indexed and governments 
might want to know if a word is in the 
index and, if so, who used it." 

If the privacy risk doesn't bother 
you, check out Gmail. 


Circuits and Devices 

Small Actuator, Precise 
Positioning 



HSI's size I I linear actuator provides 
thrusts up to 25 lb (I 1.5 kg) and resolutions 
down to 0.000125 inches (0.003175 mm) 
per step. Courtesy of HSI. 


H ayden Switch & Instrument, 
Inc. (www.hsimotors.com) , 

has introduced a new size 1 1 hybrid 
external linear actuator. The rotating, 
stainless steel, acme lead screw is 
incorporated into the motor's rotor. 
Shaft to lead screw couplings are not 
needed with this design, thus saving 
time, money, and labor during 
assembly into the final application. 
The external linear actuator replaces 
four different components: a motor, 
coupling, lead screw, and nut. 

The nut on the external linear 
actuator uses high performance 
engineering thermoplastics as the 
rotor drive nut to provide long life in 
high-precision applications. This exter- 
nal linear hybrid actuator is available 
in resolutions ranging from 0.000125" 
(0.003175 mm) to 0.002" (0.0508 
mm) per step and delivers thrusts of 
up to 25 lb (11.5 kg). A standard size 
11 external linear has four inches of 


JUNE 2004 







TechKnowledgey 2004 


visible lead screw, but lead screw 
length, coil termination, and the 
external nut can be customized. 

In this design, the lead screw is 
an integral part of the motor with a 
mating nut translating along the screw. 
As the motor steps, the lead screw 
rotates, but does not advance. Typical 
applications include medical equip- 
ment, X-Y tables, various automation 
applications, and valve control. 


Swiss Army Knife Memory 



The Swissmemory USB Victorinox 
combines a traditional Swiss army knife 
with USB memory. Photo courtesy of 
the Swissbit Group. 


Q ualifying as this month's "silly 
gadget that you would love to 
have" is the Swissmemory® USB 
Victorinox. The product is the result of 
a cooperative effort between Victorinox 
(www.victorinox.com) , the producer 
of the original Swiss army knife, and 
the Swissbit Group (www.swissbit. 
com) , a producer of computer memory 
modules, USB flash memories, and 
compact flash cards. It includes a 
stainless steel knife blade, scissors, file, 
screwdriver, pressurized pen, and a red 
LED pointer, plus either 64 or 128 MB 
of Flash memory. (For those who travel 
on airlines and don't want to trigger a 
strip search, the company also offers a 
version that excludes the sharp tools.) 
The memory portion is compatible with 
Windows, Mac OS, and Linux. Plus, to 
prevent unauthorized access to stored 
data, SecureLOCK software is provided. 
It is also possible to boot your computer 
from the device, assuming that the 
computer's BIOS allows it. The various 
configurations are priced from 55 to 72 
Euros, which was about $66.00 to 
$86.00 at the time of this writing. 

JUNE 2004 


Industry and the 
Profession 

40th Anniversary of 
System/360 



The System/360 Model 22 was 
introduced as a general purpose computer 
that combined intermediate-scale data 
processing capability with small system 
economy. Its main storage was either 24K 
or 32K. Photo courtesy of International 
Business Machines Corporation. 
Unauthorized use not permitted. 


I t hardly seems possible, but 2004 
is the 40th birthday of IBM's 
System/360 — the mainframe that 
sparked the digital revolution in the 


microcircuitry, and databases. 

More than 300 patents were issued 
as part of its development. In the original 
1964 press release, IBM Board 
Chairman Thomas J. Watson, Jr. 
called it, "the most important product 
announcement in the company's histo- 
ry." (He is not to be confused with 
Thomas Watson, Sr. who, as IBM 
Chairman in 1943, surmised, "I think 
there is a world market for maybe five 
computers.") The original System/360, 
with its eight-bit processor, offered 
clock rates (referred to as "cycle times" 
in those days) ranging from 1 to 5 MHz 
and "core memory" of 8 KB to 8 MB. 
Consistent with IBM's early belief that 
microcomputers would never catch on, 
the system boasted, "the ability to 
respond to inquiries and messages from 
remote locations at any time. Hundreds 
of terminal devices can communicate 
simultaneously with a system while the 
computer continues to process the 
basic job on which it is working." 

Back in 1964, the monthly lease 
for one of these powerhouses ranged 


87 


business world. The System/360 was 
considered by many to be the most 
sophisticated computer of its time and 
is responsible for introducing many 
primordial concepts that are still in use 
today, such as transaction processing, 


from $2,700.00 to $1 15,000.00, "for a 
typical large multisystem configuration." 
You could also buy one for 
$133,000.00 to $5.5 million. For more 
information on the history of IBM, visit 
www-l.ibm.com/ibm/history NV 


It writes your USB code! 

NO Need to be a USB expert! 

HIDmaker ($399) - creates HIDmaker Test Suite ($149) 


ready to compile PC & PIC programs 
that talk to each other over USB. 
Choose your favorite languages! 
PIC: Pic Basic Pro, CG C, Hi-Tech C, 
MPASM. PC: VB6, Delphi, C++ Builder. 
Single chip solution: PIC with built- 
in USB 


USBWatch - shows your device's 
USB traffic, even during 'enumera- 
tion', without expensive equipment. 
AnyHID - Test any USB HID device. 
See what data it sends, even what 
the data is used for. 




Trace 


'SYSTEMS, Inc. 


301 - 262-0300 

WWW.TraceSystemsInc.com 







Nuts & Volts 


In The Trenches 


by Gerard Fonte 


The Business of Electronics Through Practical Design and Lessons Learned 

In The Trenches 


Statistics — Part 2 


S tatistics is the world's most 
precise way of saying maybe. 
Engineering is rich with likelihood 
because things are rarely certain. 
There's always a chance something 
may not work right. Understanding 
how to measure "maybe" is a powerful 
tool that can aid an engineer in many 
areas. Last month’s column mostly 
dealt with basic statistical theory. 
This month, we'll apply basic 
probabilities. We'll start by looking at 
some fundamental concepts and the 
mechanics of probabilities. 

Odds Versus 
Probabilities 

There are two general methods 
for stating the likelihood of some 
event: odds and probabilities. Las 


Vegas casinos often use odds. They 
say the Yankees are three to two 
favorites to win the game. Statistics 
classes often use probabilities. They 
say that there is a 60% chance that 
the Yankees will win. Is three to two 
better or worse than 60%? Why are 
there two methods? Is there a method 
of converting between them? 

An important note: All probabilities 
are just that. They are probable 
outcomes, not guaranteed outcomes. 
The outcomes are based on the 
average of many trials. So, when I say 
that the Yankees win three out of five 
games or that a die comes up a "6" 
once out of six rolls, I assume that 
you realize that 1 mean "on average." 
Including "on average" in every 
sentence gets old really fast. 

Odds are used for betting 


because they identify wagering ratios. 
Few bets are even (or one to one). 
With three to two odds, if you bet 
$3.00 that the Yankees will win and 
they do, you will win $2.00. If you want 
to bet that the Yankees will lose, you 
have to bet $2.00 to gain (hopefully) 
$3.00. You can look at odds as a bet 
on the table. There is $5.00 on the 
table — $3.00 from someone who 
expects the Yankees to win and $2.00 
from someone who expects them to 
lose. The winner takes all. 

Odds define both the winning 
and losing ratios. The odds are five to 
one that the die will come up a "6." 
For every six rolls, "6" will come up 
once and something else will come 
up the other five times. The odds that 
you can draw the ace of spades from a 
deck of cards are 51 to one. In theory, 
"for" or "against" should be added to 
identify how the ratio is applied. This 
was done above with the "three to two 
favorites to win," but — with large 
odds — the smaller number is usually 
the "winning" value. With the deck 
of cards example, "51 to one" is 
understood to mean "51 to one 
against picking the ace of spades." 

A probability defines only the 
likelihood of the specified event; for 
example, "there is a 60% chance that 
the Yankees will win." It assumes that 
40% contains all other possible 
outcomes. Since ties are rare in 
baseball, 40% refers to the likelihood 
that the Yankees will lose. There is a 
16.7% chance that you will roll a "6" 
with a die. Therefore, there is a 83.3% 
chance that you will roll something 
else. Probabilities are almost always 
specified as percentages. An event 
that is certain to happen has a 
JUNE 2004 



n The Trenches 


probability of 100%. 

Once you understand them, 
converting from odds to probabilities 
or vice versa is easy. With three to 
two odds to win, the Yankees will win 
three out of five games. It's easy to 
see that this is 60% (3/5). Conversely, 
if they win 60% of their games, that 
means that they win 60 out of 100 
games. Just reduce the fraction 
60/100 and you get 3/5. This means 
that they win three games and lose 
two games out of every five or have 
winning odds of three to two. The 
odds of "three to two favorites to win" 
are the same as a "60% probability of 
winning." We'll use percentage proba- 
bilities for the rest of this discussion. 

Unfortunately, in engineering, 
simple probabilities like these are 
rare. You almost always have to 
consider a number of events and 
determine the likelihood of all these 
events together. Let’s look at basic 
combinations of probabilities. 

The Probability of 
And 

Suppose you know that a high 
voltage capacitor has a 1% chance of 
catastrophic failure if the power regulator 
fails. The regulator fails 1% of the time 
when there is a power spike of 300 
volts on the AC line. Given that there 
is a 300 volt power spike, what is the 
chance of the capacitor exploding? 

This is easy. Just multiply the 
probabilities together because both 
the capacitor and the regulator must 
fail. Therefore, 0.01 times 0.01 is 
0.0001 or 0.01%. There is a 0.01% 
chance (or one chance out of 
10,000) of the capacitor exploding 
whenever there is a 300 volt power 
spike. 

That seems pretty safe — except 
for the times the system is used 
where motors are on the same cir- 
cuit. Starting and stopping large 
electric motors can easily place 300 
volt spikes on the AC line and, if the 
motor is started and stopped only 10 
times a day, then there are about 
5,000 spikes per year. The life 
expectancy of your product is not 
JUNE 2004 


very good in such an environment. 

The Probability of 
Or 

There are two different types of 
statistical or events: single and 
multiple. The single event or is just 
the simple summation of the individual 
probabilities. For example, rolling a "2" 
or a "3" on a six-sided die has a two out 
of six chance or a 33% probability. This 
is just common sense. Rolling a 1,2,3, 
4, 5, or 6 has a 100% probability. This 
is because there are only six sides on a 
die and one of them must come up. 
This is pretty obvious. 

The tricky or is when there are 
multiple events. You want to roll a "6" 
and you have six dice. You can clearly 
see the difference. You know intuitively 
that there is a chance that no "6" may 
occur. This is different from the single 
event or above, but many people still 
think that rolling two dice gives you 
twice the chance. This is simply wrong. 

So, what's the probability of rolling 
a "6" with six dice? The easiest (though 
tedious) way to figure this out is to sum 
the probabilities on a die by die basis. 
(There are other, more sophisticated, 
methods to directly calculate this.) 

The first die gives you 1 /6 chance 


or 16.7%. The second die only needs 
to be rolled if the first die fails. So, you 
will roll the second die 83.3% of the 
time. (That's just 100% minus the 
probability of the first die.) This means 
that you take 16.7% of 83.3%, which is 
13.9% for the second die. Summing 
these two percentages (13.9% and 
16.7%) gives you a 30.6% probability 
of rolling a "6" with two dice. (This is 
less than the 33% chance for the single 
event or in the previous example.) 

For the third die, you again 
take 16.7% (1/6) of the remaining 
percentage (100% - 30.6% = 69.3%), 
which is 11.6%. You add that to the 
running total (30.6% +11 .6%) to give 
42.2%. For the fourth die, you again 
take 16.7% of 57.8% (or 9.7%) for a 
total of 52%. The fifth die is 16.7% of 
48% (that's 100% - 52%) or 8% for a 
total of 60%. The last die is 16.7% of 
40% or 7% for a final sum of 67%. 
Therefore, rolling six dice will give 
you a 67% chance of rolling a "6" (or 
more than one "6"). 

I detailed all six dice because it's 
important to see the progression. 
Each additional die provides a smaller 
increase in the probability. This critical 
concept is often overlooked, but this 
does make sense. Everyone knows 
that you could roll 100 dice and not 


Scope Training That Makes Sense! 

Our 1-Hour Video and 
« Tech Manual Will Get 

BhUI You Up To Speed 

Quickly. 

Operate Basic Scope Controls IflCludGS Certification Exam 

set Trigger Level from SYSPEC! 



VHS tape & Tech Manual Just $34.95 + $5 S/H (US 
je addresses) NYS residents add sales tax... 

a More! Send Check or M.O. to: 

S YSPEC INC 

(www. s vs pec. com ) PO B °* 2546 

l 1-877-SYSPEC1 J Syracuse NY 





Nuts&Volts 


In The Trenches 


possible. (By the way, it makes no 
difference if you roll six dice once 
each or a single die six times.) 

Using Probabilities 
and Statistics 

So far, we've learned what Las 
Vegas bookies mean, improved our 
poker game, and enhanced our Yatzee 
playing. How do we use this stuff 
in engineering? Probably the most 
important aspect is that you begin to 
be familiar with the fundamental 
concepts. So, when someone says that 
the "Mean Time Between Failures" (or 
MTBF) is 10,000 hours, you have some 
idea of what that means. Probability 
and statistics is a vast field and, 
truthfully, you'll have to learn a lot more 
than what is presented here in order to 
use it effectively. However, even these 
meager tools have some utility. 

Let's take a practical example of 
a digital data communications 
system. You've measured it with your 
brand new Bit Error Rate (BER) tester 
and gotten a 0.000001 reading. What 
does that mean? What type of Error 
Detection and Correction (EDC) soft- 
ware is needed? What BER would you 
need to use a simpler EDC software? 
Is it more cost-effective to improve 


the hardware or the software? 

The BER measurement means 
that there is one error for every 
1,000,000 bits (which isn't very 
good). However, acceptable error 
rates depend upon what is being sent. 
If you are sending ordinary TV video, 
this rate might be acceptable. It 
would mean that a few pixels would 
be wrong per frame. It probably 
wouldn't be noticed by viewers, 
except in special circumstances (like 
an all-black screen with a few added 
sparkles). However, suppose you are 
sending credit card information from 
bank to bank. I think you can see that 
even a handful of errors in a large file 
can create very significant problems 
in this sort of application. 

EDC software can be simple or 
complex, but a probability is inherent 
in every error detection system. This 
is the probability of multiple errors. 
Any error detection can guarantee to 
find some fixed amount of errors; 
however, as the number of errors 
increases, the probability of detection 
falls. If an error is not detected, it 
certainly can't be corrected. What this 
means is that the statistical distribution 
of errors is important. Do the errors 
come fairly regularly, one at a time, or 
are there are bursts of many errors 


The Standard for checking 
Capacitors in-circuit 

Good enough to be the 
choice of Panasonic, 
Pioneer, NBC, ABC, Ford, 
JVC, NASA and thousands 
of independent service 
technicians. 

Inexpensive enough to pay for itself in just 
one day’s repairs. At $179, it’s affordable. 

And with a 60 day trial period, satisfaction 
guaranteed or money-back policy, the only 
thing you can lose is all the time you’re 
currently spending on trying to repair all 
those dogs you’ve given up on. 


Locate shorted or leaky 
components or conditions 
to the exact spot in-circuit 

Still cutting up the pcb, 
and unsoldering every 
part trying to guess at 
where the short is? 

$179 

Your DVM shows the same shorted reading all 
along the pcb trace. LeakSeeker 82B has the 
resolution to find the defective component. 
Touch pads along the trace, and LeakSeeker 
beeps highest in pitch at the defect’s pad. Now 
you can locate a shorted part only a quarter of 
an inch away from a good part. Short can be 
from 0 to 150 ohms 


CapAnalyzer 88A LeakSeeker 82B 

Available at your distributor, or call 561-487-6103 

Electronic Design Specialists www.eds-inc.com 




90 


followed by a relatively long period of 
accuracy? 

A checksum is a common error 
detection system that is useful to look at. 
Many common checksums consist of 
four digits (sometimes hexadecimal 
digits) and they can always detect a 
single error, but suppose someone jiggles 
the cable as you are transmitting the 
file and this causes a whole page of 
data to be dropped. What is the chance 
that the checksum will find this? 

You have to treat the new 
checksum as a random number 
because of the significant corruption 
of the data. Since there are four digits 
in the checksum, there is one chance 
out of 10,000 (or 65,536 for hex) that 
it will match the proper checksum 
based on chance alone and thus 
avoid detection. The other times, it 
will be detected. Maybe. 

The "maybe" is because checksums 
are created by the data that is being 
sent. There are often patterns in data. 
So, if part of a pattern is removed and 
another pattern just happens to fall in 
the proper sequence, the checksum 
may not detect the error. The chance 
of this happening depends on the 
checksum generator and the data 
being sent. The net result is that the 
chances of detecting bad data are 
reduced by some amount. 

While this scenario may not seem 
significant, it has the potential to 
greatly reduce the probability of error 
detection. I'm including it because the 
concept of extraneous factors affecting 
failure probabilities is often overlooked. 
In fact, very often these extraneous 
factors are the key agents in failures. It 
is critically important to be aware of 
this. Too many statistical analyses are 
flawed by not considering it. 

Human factors were not considered 
in the Three Mile Island nuclear power 
plant analysis. Falling foam was not 
seriously considered in the Space 
Shuttle analysis (even though the fact 
that it happened with regularity was 
known). A relatively small hull breach 
over several watertight compartments 
sank the Titanic, since the designers 
had looked at head-on collisions 
rather than scraping collisions. The 
JUNE 2004 



In The Trenches 


list is extensive. Again, remember 
that statistical analysis is only the 
starting point. It only provides the 
"best case" circumstance. 

Timing Problems 

Your new autonomous robot 
works well, except for an occasional 
glitch in the automated steering 
system. Every now and then — roughly 
once an hour — it just goes off in its 
own direction. Why? 

You are using 4000 series CMOS 
logic chips in your custom controller. 
You are running them at 5 volts, so 
power drain from the batteries is kept 
low. You purchased a stand-alone, 
ultrasonic range finder that has its own 
controller that runs independently of 
your controller. It sends TTL level 
ranges (24-bit values) to your controller 
at a rate of 100 per second over a 
serial RS-232 line. You add a diagnostic 
circuit and find that, when the system 
fails, your controller sees a range value 
that makes no sense. Is your controller 
reading the value wrong or is the range 
finder sending bad data? 

You look at the circuit and see that 
the 4510 BCD counter in the RS-232 
circuit needs 130 nS to recover from a 
reset. Your computer resets this after it 
has read and processed the data. You 
never worried about missing the next 
range because a range change in 
1/100 of a second is trivial. 

The subtle — but significant — 
point is that the processing takes a 
variable amount of time. Thus, the 
reset is effectively asynchronous with 
the range data coming in. Could this be 
a concern? We'll simplify the problem 
by just looking at the probability that 
a range bit transition occurs during 
the 130 nS reset recovery time. This 
would result in bad data being read 
and the robot wandering off. 

This is an and probability. The bit 
transition and the reset recovery time 
must occur at the same time. There 
are 2,400 bit transitions per second 
(100 values at 24 bits/value). Multiply 
this times the 130 nS reset recovery 
time and you get 0.0003212 seconds. 

What this means is that, 
JUNE 2004 


0.0003212 seconds out of every 
second, an overlap can occur. 
Expressed as a probability, it says that 
there is a 0.03212% chance than an 
error will occur in any particular 
second. We can convert this to the 
probable time per error by inverting it 
(1/0.0003212), which gives the result 
of 3,1 13 seconds per error. Converting 
to minutes (3113/60) gives 51.88 
minutes per error. 

This result closely matches what 
we have seen. About once every hour, 
there is a bad range value. This is a 
good place to start troubleshooting. 
Of course, it doesn't guarantee that 
this is the problem. Rather, this 
provides some strong evidence that 
this could be the cause. 

Rounding Errors 

Many microcomputers (jlC) have 
simple, floating point math routines. 
It's not all that unusual to find ones with 
a 16- or 24-bit mantissa (the decimal 
part) and an eight-bit exponent. 
Suppose you have to choose between 
them. Your mathematical operations 
are quite extensive, with about 10 mul- 
tiplications per routine. You know your 
final result has to be accurate to 0.02% 
(one part in 5,000). The 16-bit routines 


seem adequate for this (one part in 
65,536), but how can you be sure? 

First, I just fibbed. The 16-bit 
routines are only really accurate to 
one part in 32,768. This is because 
one bit has to be used for the sign bit 
(positive or negative value). So, while 
your value can be from +32,767 to 
-32,768, the magnitude of all math 
operations is limited to 32,768. Well, 
that's still six times more than what is 
needed. Isn't that good enough? 

Actually, the answer is probably 
not and the reason is due to rounding 
errors. Rounding errors can occur 
whenever there is a conversion from 
one exponent to another. (Note, 
some systems don't round; they 
truncate. In this example, there is no 
difference.) Because there are only 
16 bits available, any result that is 
greater than 16 bits must be reduced 
to fit into 16 bits. This can occur with 
multiplication or addition. When you 
divide, the remainder needs to be 
rounded. Rounding errors don't 
always occur, but — when they do — 
they cause up to a 0.5 bit error. 

So, what's the big deal about a 
0.5 bit of error? The big deal is that 
these errors are cumulative. If you 
perform 10 multiplications, you could 
get 10 times 0.5 bits or five bits of 




BASIC MICRO 



OUR Brains 

The Basic ATOM line of Microcontrollers Starting at just $49.95 


Have a project that a microcontroller would work great with? Want to avoid a large upfront investment? Interesting in 
integrating a microcontroller into a design but don't want the hassle of the extra circuitry needed to support them? 
Programmable in easy-to-use BASIC language the BasicATOM is the logical place to start. Standard features include: 
14K of Program Space, 256 Bytes of user EEPROM, over 33,000 Instructions per second, 3 Hardware Timers, Up to 8 
Built-in Analog-to-Digital converters, 32 x 32 Bit Math, Floating Point Math, Firmware Upgradable, and more. 

Visit us online atWWW.BASICMICR0.C0M to see our complete product line or call toll free 1-800-869-5095 



NufS&VOLTS 


In The Trenches 


error — worst case. This is indeed a 
big deal. Five bits of error reduces 
your 15-bit (plus sign) accuracy to 10 
bits. This is only one part in 1,000 
accuracy. That's 1/5 of what you 
need, but your answer might also be 
perfectly accurate to 15 bits. 

Here's how you get a grip on this 
problem. First, how often will the worst 
case occur? All 10 math operations 
have a 50% chance each that the 
rounding caused an error in the last bit. 
The chance that every operation had 
an error is another and probability. 

Multiply the probability (0.5) by the 
probability of every possible occurrence 
(10). This is 0.5 raised to the 10th 
power or 0.000976 (or 0.0976%). 
Conveniently, this is just the inversion 
of two raised to the 10th power or 
1,024. So, the error will be five bits 
once out of every 1,024 calculations. 
It's useful to note that the answer will 
be perfect (no rounding errors at all) 
by an identical probability. 


The average error can also be 
calculated. There are 10 operations 
that each have a 50% chance of 
occurring. This means that an average 
of five errors will occur per calculation. 
(This is another and probability. 
Multiply the number of operations by 
the probability.) Sum these five errors 
of 0.5 bits each to give an average 
error of 2.5 bits. This reduces your 
accuracy to 12.5 bits, which is just 
about one part per 5,000. You will 
have to decide if your system can 
manage with occasional results that 
are not as accurate as needed, even if 
the average accuracy is acceptable. 

The significance of 

rounding/truncation errors is often 
overlooked. This is especially the 
case when complex math routines 
are forced into small computers. 
Running a Fast Fourier Transform on 
a pC may be possible, but it may also 
be impractical and unreliable. 

It's also important to note the 


difference between resolution and 
accuracy. The resolution of the 
system never changed. It was always 
15 bits plus sign. The accuracy clearly 
changed and was dependent upon 
various operations. 

Conclusion 

We looked at a few tools that 
probability has to offer. There are 
many more. We've also looked at 
three specific examples of fairly 
common engineering problems and 
have seen how probability and 
statistics can be applied. The truth is 
that a reasonable understanding of 
the basic statistical principles can be 
a powerful tool in almost any technical 
field. Conversely, a lack of education 
or experience in this area can hamper 
anyone's career. I hope that these two 
columns on statistics have provided 
some insight and created some 
interest in this topic. NV 



LabJack 
U12 

lable now for only ... 

$1 1 9 qty 1 

($99 qty 10+) 


USB Data Acquisition 
& Control 


Built-in screw terminals 
Easy-to-use USB 
Everything included 
Use with C, VB, LabVIEW, etc. 
Windows 98SE/ME/2000/XP 


* 12-bit analog inputs (8) 

* 10-bit analog outputs (2) 

* 20 digital I/O 

* 32-bit counter 


A 


Made in Colorado, USA, by LabJack Corp. 
info@labiack.com, (303) 942-0228 



■ Premodified R/C servos (56 oz-in) 

■ Rubber wheels (tank uses rubber treads) 

• Precision-cut pre-drilled expanded PVC plastic bases 

■ Illustrated assembly instructions (3D exploded views) 

■ Additional stackable decks available 



| WWW.BUDGETROBOTICS.CaM | 


92 


JUNE 2004 



Tech Forum 


Tech Forum 


QUESTIONS 

Does anyone know how I might 
construct a relatively simple field 
strength meter to orient a CJHF 
antenna while I’m perched on a 
ladder? Past attempts have involved 
going repeatedly between the TV and 
the roof. The circuit would be tuned to 
one specific frequency — say 500 
MHz. 

#6041 Chris Paterson 

Ottawa, Canada 

I would like to have my garage 
open automatically when I pull up in 
the driveway. Maybe I could use an IR 
transmitter on my garage and an IR 
receiver in my car? The IR on the 
garage could transmit a constant 
signal so that when the receiver (in 


my car) picked it up, the door would 
automatically open. Any suggestions? 

#6042 Doug Barnes 

via Internet 

I purchased a Seiko R-Wave 
atomic clock for my work area. It 
worked fine for about six months, 
placed on a cement ledge with a 
window behind it, but, right after 
daylight savings time, it stopped 
picking up the signal. If I move it to 
another location (facing a different 
direction) it works fine. Any ideas on 
how to make some kind of amplifier 
to help it? This is the only location 
where everyone can see it. 

#6043 Terry Arnall 

Hayward, CA 

If I were to take two 500,000 volt 


This is a READER-TO-READER Column. All 
questions AND answers will be provided by 
Nuts & Volts readers and are intended to 
promote the exchange of ideas and provide 
assistance for solving problems of a technical 
nature. All questions submitted are subject to 
editing and will be published on a space 
available basis if deemed suitable to the 
publisher All answers are submitted by readers 
and NO GUARANTEES WHATSOEVER are 
made by the publisher The implementation of 
any answer printed in this column may require 
varying degrees of technical experience and 
should only be attempted by qualified 
individuals. Always use common sense and 
good judgement! 

Send all material to Nuts & Volts Magazine, 430 
Princeland Court, Corona, CA 92879, OR fax 
to (909) 371-3052, OR email to 

forum@nutsvolts.com 


ANSWER INFO 

• Include the question number that appears 
directly below the question you are responding 

• Payment of $25.00 will be sent if your answer 
is printed. Be sure to include your mailing 
address if responding by email or we can not 
send payment. 

• Your name, city, and state, will be printed in 
the magazine, unless you notify us otherwise. If 
you want your email address printed also, 


indicate to that effect. 

• Comments regarding answers printed in this 
column may be printed in the Reader 
Feedback section if space allows. 

QUESTION INFO 
To be considered 

All questions should relate to one or more of 
the following: 

1) Circuit Design 

2) Electronic Theory 

3) Problem Solving 

4) Other Similar Topics 

Information/Restrictions 

• No questions will be accepted that offer 
equipment for sale or equipment wanted to 

• Selected questions will be printed one time 
on a space available basis. 

• Questions may be subject to editing. 

Helpful Hints 

• Be brief but include all pertinent information. 
If no one knows what you're asking, you won't 
get any response (and we probably won't print 
it either). 

• Write legibly (or type). If we can't read it, we’ll 
throw it away. 

• Include your Name, Address, Phone Number; 
and Email. Only your name, city, and state will 
be published with the question, but we may 
need to contact you. 


stun guns and connect both positive 
outputs together and both negative 
outputs together, would I have 
1,000,000 volts? Does the voltage 
double? I ‘m not planning on building 
an assault weapon, just an 
experiment which uses high voltage. 
#6044 Jonathan 

via Internet 

I have a number of PCI interface 
cards that lock up the computer on 
boot. The cards are designed to work 
in both Macs and Intel PCs to 
interface the computer with an image 
setter. I want to fix the cards or have 
them repaired by a third party. I don't 
have any schematics, other than the 
standard PCI interface protocol. 

The replacement cost of these 
boards is around $1,200.00 each, so 
repair costs of a few hundred per 
board would not be unreasonable. 

Each board contains five 
programmable chips that I can swap 
out with ones that I know are good. 
There are SRAM chips and 
controllers, a good number of 
capacitors, and a PCI Matchmaker 
Chip — all surface mounted. That’s it. 

How would I go about fixing these 
cards? 1 thought of sending them out 
to have them reverse-engineered to 
get schematics, but I have never done 
this and I don't know how reliable the 
service is. 

#6045 P. Sarantos 

via Internet 

ANSWERS 

[2041 I — February 2004] 

/ am about to purchase a DVD 
recorder/player. A sales person at a 
consumer electronics outlet told me 
that there were three formats — 
plus, minus, and progressive — but 
could not describe any of them. I 
know what progressive scan is, but 
what about the other two? I do not 
understand how a disc recorded in 
progressive scan can be played 
back on an interlaced monitor. 

There are actually five DVD 
formats: DVD-R, DVD-RW, DVD+R, 
DVD+RW, and DVD-RAM. DVD-RAM 
is the original, recordable DVD media. 
It was used in a plastic cartridge, 

93 


JUNE 2004 



siiOAfsinN 


Tech Forum 


similar to the obsolete CD caddies that the old Macintosh 
computers used to have. DVD+R and DVD-R are very much 
alike, since they both hold 4.7 GB of data. The only 
difference is that they are recorded and played differently. 
DVD+R will play in a computer DVD drive and in most DVD 
players made within the last year. DVD-R is more 
compatible and will play in older DVD players (over a year 
old), newer DVD players (made within the last year), and 
computer DVD drives. 

As far as which format to go with, I would recommend 
DVD-R. All of the DVD movies sold in stores are recorded on 
DVD-R discs. 

Progressive scan has nothing to do with the physical 
DVD disc or even the movie copied onto it. Progressive 
scan and interlacing are just how the DVD player reads the 
disc. Progressive scan produces a better picture, so when 
buying your DVD burner/player, I would suggest you go for 
a model with progressive scan. 

Mike Ajax 
St. Charles, I L 


[3041 — March 2004] 

My local middle school is using an old scoreboard 
system in the gym for basketball games. The old 
mechanical timer no longer works and I would like to 
replace it with an electronic timer that can trigger a 
relay to activate the scoreboard buzzer. It will need to 


Seetron Serial LCDs 

Interface a sharp LCD display to your BASIC Stamp® or other 
micro-controller project with ease. No-solder wiring harnesses 
and easy mounting kits available too. See www.seetron.com today. 


• 3.2 x 1.4 in. supertwist LCD $45 

• 2400/9600 baud serial BPI ' 2161 

• Low (=2mA) current draw 

• Great with BASIC Stamps® 

• 3.2 x 2 in. backlit LCD $49 

• 1200-9600 baud serial ILM ' 2161 

• Advanced protocol, 4 switch inputs 

• EEPROM for configuration settings 

• Favorite for OEM applications 

• 3.2 x 1.4 in. graphics LCD J X 9 ® 0L 

• 2400/9600 baud serial 

• Font and 15 screens in EEPROM 

• Easily draw points, lines, screens 



• 3 x 2 in. supertwist LCD $119 

• 1200-9600 baud serial trm-^sl 

• ESD-protected, 4x4 keypad input 

• Store up to 95 screens in EEPROM 



Scott Edwards Electronics, Inc. 

1 939 S. Frontage Rd. #F, Sierra Vista, AZ 85635 
phone 520-459-4802 • tax 520-459-0623 
www.seetron.com • sales@seetron.com 


More displays available, 
including bright VFDs. 
See www.seetron.com 


94 


have two timed selections — 30 and 60 seconds — and 
only needs to activate the buzzer for two seconds. 

Why design from scratch when you can "steal" from a 
perfectly good, existing design? What better place to steal 
from than Nuts & Volts Magazine ? 

See page 34 of the March 2004 issue. Minor 
modifications to the “558 circuit” shown in Figure 10 will 
provide exactly what you need. 

First, remove the line that goes from the output of the 
last timer (the “timing” pin), through the 10K resistor back 
to the “trigger” input of the first stage. This changes the 
circuit from a repeating “ring counter” to a “one-shot” 
which is what you want for the “time-out buzzer” circuit. 

Next, change the three 3,300 mF capacitors to 68 mF. 
This will give the first timer stages a range of 0-60 seconds 
each, instead of minutes. (Note: The exact values for the 
capacitors aren't critical — anything up to about 100 
mF or so is usable. Caution: The first stage capacitor 
does need to be a minimum of about 45 mF and the 
second/third stage caps must be a minimum of about 
20 mF. Similarly, for the fourth stage capacitor, you 
could use anything down to 4.7 mF.) 

Lastly, for the first stage, replace the 1 meg 
potentiometer with a SPDT switch that selects one of two 
identical 1 meg potentiometers (we'll call them A and B). 

This circuit does require initial calibration. The process 
is: 

With the switch selecting the “A” potentiometer, adjust 
the pots on the three leading stages so that you get a 30 
second delay. You want “approximately equal” settings on 
all three potentiometers. When you get close to 30 
seconds, you can do the final adjustments using only the 
second or third stage pot. Now, adjust the last pot for the 
two second buzzer duration. 

Now, switch to the “B” pot and adjust it only until you 
get a 60 second delay. The circuit is now ready for use. 

The added SPDT switch selects the 30 second or 60 
second delay and the momentary button from the original 
circuit starts the timer. This circuit uses the SPDT switch 
and two potentiometers — rather than using “marked” 
positions on a single potentiometer — to provide 
"repeatability" for the timer intervals. 

Note: Once set, the second and third stage pots should 
never need adjustment. Any minor timing drift can be 
compensated for by adjusting the “A” and “B” pots. Precise 
duration on the buzzer isn't critical either, so the last pot 
probably won't require future adjustment, either. 

Robert Bonomi 
Evanston, II 


[3048 — March 2004] 

I would like to install a cat door in an outer wall 
that can move up and down. I envision a motorized 
rack and pinion assembly with a pressure sensor that 
would control the operating circuit. / need sources for 
rack and pinion assembly. 


You can pick up a motorized rack and pinion assembly 
JUNE 2004 




Tech Forum 


at an auto salvage yard. These are used in cars with 
electric seats to move the seats back and forth and up and 
down. Alternately, you can consider the motorized 
assembly that is used on electric car windows. Don't forget 
to put optical or other sensors in the doorway to prevent 
your cat from being squished. 

Leon Mysch 
Brooklyn, NY 


[3042 — March 2004] 

/ need a charger circuit for a 6 V 4.5 Ah gel cell. I 
understand that these batteries should be charged from 
a constant voltage source until the battery voltage 
reaches 7.2 to 7.35 volts, with the current not to exceed 
900 mA. 

The circuit below has been around for awhile and is a 
relatively simple solution to the problem. 

The LM317 does double duty in first supplying a 
constant current to the gel cell until it is charged and then 
switching to a constant voltage supply to maintain the 
charge. The only drawback is the circuit must be reset 
before every charging cycle. With the component values 
shown, the charging current is approximately 400 
miliamps until the charge cycle ends and then a small 
current of approximately 20 miliamps keeps the cell 
topped off. The charging current can be altered by 
changing the value of R5 per the formula R5 = 
1.25/charging current. The SCR is not critical, but should 
be one with a "sensitive gate" and a low holding current (at 
minimum 15 miliamps). The one shown can handle 800 
miliamps with a 5 miliamp holding current. In this circuit, 
maximum current through the SCR is no more than 20 
miliamps. 

To adjust the circuit, replace the battery with a IK 
resistor. Adjust R2 until it is on the positive side of its 
adjustment to insure the SCR will be "on" and the LED will 



Schematic and PCB Layout 


• Powerful and flexible schematic capture. 

• Auto-component placement. 

• Rip/entry PCB routing. 

• Polygonal gridless ground planes. 

• Library of over 8000 schematic and 1000 PCB foot prints. 

• Bill of materials, DRC reports and more. 


Mixed Mode SPICE Circuit Simulation 


• Berkeley SPICE3F5 simulator with custom extensions for true 
mixed mode and interactive simulation. 

• Six virtual instruments and 14 graph based analysis types. 

* 6,000 models including TTL, CMOS and PLD digital parts. 

* Fully compatible with manufacturers' SPICE models. 


Proteus VSM - Co-simulation & debugging for popular Micro-Controllers 


• Supports PIC16 & PIC12, AVR, 8051, HC1 1 and ARM micro-controllers. 

• Co-simulate target firmware with your hardware design. 

• Includes interactive peripheral models for LED and LCD displays, 
switches, keypads, virtual terminal and much, much more. 

• Provides source level debugging for popular compilers and 
assemblers from HiTech PICC, Crownhill, IAR, Keil and others. 


Microchip PIC 18 


• Supported models of the PIC 1 8 includes PIC1 8F242, PIC1 8F252, 
PIC18F442, PIC18F452, PIC18F248, PIC18F258, PIC18F448 and 
PIC18F458. 



Basic Stamp BS 1 and BS2 


• Proteus VSM for BASIC Stamp contains everything you need to 
develop and simulate designs based around the BASIC Stamp. 

* See examples in downloadable Demo at 
www.labcenter-electronics.com 


“I finished my first design, schematic and PCB in one day." 

"What a great tool! I love it." dan gill 

“For the cost of the software compared to the productivity gains, I consider Proteus to be 
pivotal in the commercial viability of my company and by far represents the best value 
for money of anything Tempus possesses." ROB YOUNGS, Tempus Consulting 

"PROTEUS stands out as the best ali-round program in this review. Other programs 
reviewed have strengths in the pcb design process, Proteus maintains a constant high 
level of capability throughout. Whether a schematic, user-friendly interactive routing, 
configurable autoplacing, competent autorouteing, or a combination of the above, 
PROTEUS handles everything very well." Electronic & Wireless World CAD Review Roundup 


Save Time. Save Money. 

Proteus Starter Kit -$199 • Full System - $1899 
"This is clearly superior in every respect." 

B4 systems inc. I^bcenben 

WWW.labcenter-electroniCS.com Tel: 905-898-0665 info@r4systems.com 








Nuts ' a Volts 


Tech Forum 


also be on. Adjust R6 until the voltage 
across the 1 K test resistor is 7.3 volts. 
Remove the power and re-adjust R2 to 
the negative side of its adjustment 
and remove the IK test resistor and 
connect the battery in its place. 

Connect a voltmeter across the 
battery. Re-apply power and note the 
full 400 miliamp charging current will 
be supplied to the battery and its 
voltage will start to rise. It could go as 
high as 8 volts, depending on how 
much charge is in the battery. Adjust 
R2 until the LED comes on. Try to do 
this when the battery voltage reaches 
7.3 volts. It will be necessary to 
remove power and repeat this 
procedure several times until the LED 
comes on when the battery reaches 
between 7.3 and 7.5 volts. 

Charles Irwin 
Hendersonville, NC 

[2049 — February 2004] 

I am an electronics teacher 
hunting for electronics jokes to use 
in class. The cornier the better! 


# I There were four of us working in 
a TV repair shop 30 years ago. It was 
said of that shop that there was a lot 
of contrast, but not much brightness. 

Ron Lindow 
Pittsburgh, PA 

#2 When I was a kid, I used to have 
a sign in my ham shack that read 
"DANGER!!! 20.000 OHMS!” It 
seemed effective with my kid brother. 

Dave Koch 
Mountain Home, ID 

#3 If a marching band is playing in 
a storm, who is most likely to be 
struck by lighting? The conductor! 

Jon Garee 
Newark, OH 

#4 Did you hear about the baker 
who got electrocuted? He sat on a 
bun with a current in it! 

Farnham Cornia 
Toledo, WA 

[30410 — March 2004] 


What is the best place on the 
web to access IC data sheets? For 
example, if you input 555, you get 
to look at the pinouts of a device. 

#1 If you are looking for just the 
pinout information, then try 
www.chipdir.org Fairchild 

Semiconductor website ( www.fair 
childsemi.com) has full datasheets 
on a wide variety of digital ICs. 

You can also tr y www.findchips 
■com to locate vendors who sell ICs. 
Some will provide datasheets, as well. 

Daryl Rictor 
via Internet 

#1 A good website for IC data is 
www.questlink.com not only for 
chips but for components. Some 
information is given directly on the 
website and there are usually links to 
the sites of the IC manufacturers, 
where full data sheets can usually be 
downloaded. 

Bill Stiles 
Hillsboro, MO 































CircuitSpecialists.com CircuitSpecialists.com CircuitSpecialists.com 


Protek 

‘Next Generation’ Digital Multimeter , 

Well equipped DMM with True RMS, 3- 
3/4 Digits, RS-232C Interface, 4000 
Count, Auto-Ranging, Analog Bargraph 
10MHz Freq. Counter & much more ! 

Item# PROTEK506 £449 

Sale $99.00 ! 


Details at Web Site 
^ > Test Equipme 


> Digital Multitm 



/^esd Safe Thru-Hole \ /" Digital Laser Tachometer 
Soldering/Desoldering * 5 digit 6 » LCD Disp i ay 

Repairing System 1 *2.5-99,999 RPM 

Item# CSI701 - test range ■ ($49.00! 

^ *Auto-Rangmg 


SchmartBoard Combo Pack 

Item# 900-0001-01 $49.95 


Pre-traced printed circuit boards 
that are connectable like build- 
ing blocks. They allow one to 
build electronic circuits on a 
SchmartBoard block by block, 
and then connect the blocks 
together to form a functional 
board. Contains 26 parts. 

Details at Web Site 

^^^^readboatd^&^rototy^ip 



Only 

$199.00! 


& desolder gun. Built-in double 
cylinder vacuum pump. 

Details at Web Site 
> Soldering Equipment & Supplies 
^ > ReworkStations 

•cuitSpecialists.com ) 


r lachometer r 

($49^00!)^B 

Item# 

DT-6234C gsZg] 

' Test Equipment j 


*Easy to Navigate 
*Includes a Search Engine That 
Really Works 

*New Items Added Constantly 


/''"Triple Output Bench Power Supply^N 

with Large LCD Displays 
Output: 0-30VDC x 2 @ 3 AMPS 
& lea. fixed output @ 5VDC@3A 
Source Effect: 5xlO" 4 =2mV 
..•••:» .ii_ M Load Effect: 5x 1 0‘ 4 =2mV 
•*••••«• V Ripple Coefficient: : <250uV 

'. X. -I l . _Tf- V Stepped Current: 30mA +/- 1mA 

- — : — Input Voltage: 110VAC 
CSI3003X3.. $179.00 _ . t w , „ , 

Details at Web Site 


(qty 5+.. $169.00) 


> Test Equipment > Power Suppl 


Circuit Specialists Soldering Station 
w/Ceramic Element & 

Seperate Solder Stand new! 

* Ceramic heating element for l 
temp control 

*Temp control knob in F(392° to 896°) & 

C(200° to 489°) 

*3 -prong grounded power cord/static safe tip 

* Seperate heavy duty iron stand 
*Replaceable iron/easy disconnect Item# 

*Extra tips etc. shown at web site CSI-STATION1 

Also Available w/Digital Display 
& Microprocessor Controller 


Item# CSI825A++ 

FANTASTIC 
VALUE!! 
Microprocessor 
Controlled ! 

Includes 4 Nozzles ! 


*4 


Item# 

CSI-STATION2 


|$49.95| 




SMD RE-WORK SYSTEM 

w/Vacuum Pick-up tool. 

Details at Web Site 
in^E^ui^men^^^u^l^ 


m s ' 

S ince 1971 SMD RE-WORK SYSTEM w/Solder Iron 
Item# CSI906 


Item# ^001 
CSITWZ-STATION 

es > Soldering Stations 


Hand-Held 3.0GHz Universal Counter 



*10 digit LCD Display 

*High speed 300MHz direct counter w/O.lHz resolution 
*50 Ohm input for full range lMFIz to 3.0GHz coverage 
*Ultra sensitive synchronous detector w/16 segment 
bargraph display of RF signal strength 
*4 selectable gate speeds 
*Hold switch locks display 
*Low power consumption 

Details at Web Site 


I Item# 

I FC1002 


Measurement 

INCLUDES: 


Now Only 

$99.00! 


♦Internal 4AA Nic£ 
*9VDC, 500mA w 
♦Pocket Sized Testi 


Super Economy DMM CSI830 

10 50± 

$7.99 $6.99 


$9.99 



1999 count LCD Display 
15mm digit height 
H£E DATA HOLD 
Audible Continuity *DC Volts:200m/2V/20V/200V/600V 
Rubber Boot & * AC Volts: 200/600 

Test Leads *DC Current: 200n/2m/20mA/10A 

Included *Resistance:200/2K/20K/200K/2M 

Details at Web Site *Size: 138 x 69 x 31mm 

Test Equipment > Digital Multimeters/World Beater Prices 


I able to shrink, "Heat shrink tuomg . ■ 

l Details at Web Site CSIHOTGUX-2 $89.00 X 


Single Output DC Bench Power Supplies 

High stability digital read-out bench power supplies 
featuring constant voltage and current outputs. Short- 
circuit and current limiting protection is provided. 
SMT PC boards and a buift-m cooling fan help ensure 
reliable performance and long life. 

*Source Effect: 5xlO' 4 =2mV 
*Load Effect: SxlO^mV 
*Ripple Coefficient:: <250uV 
*Stepped Current: 30mA +/- 1mA 
CSI3003X: 0-30v/0-3amp/l-4.,$89.00/5+ .$85.00 
CSI5003X: 0-50v/0-3amp/l-4,.$99.00/5+..$95.00 
CSI12001X: 0-120v/0-lamp/l-4..$109.00/5+.. $103.00 

Details at Web Site > Test Equipment > Power Supplies 


As Low As 

$85.00! 






C i rcui tSpec ialist s. com 




Digital Storage Oscilloscope Module 

Convert any PC with USB interface 
to a high performance Digital 
Storage Oscilloscope. This is a 
sophisticated PC basedscope adaptor 
providing performance compatible 
to mid/high level stand alone prod- 
ts costing much more! Comes 

Details & Software Download 
at Web Site 

> Oscilloscopes/Outstanding Prices 

Item# 200DSO ,$ 859.00 



2 AMP, 0-18VDC > 

Bench Power Supply 

LCD Display 
Input voltage: 110VAC 
Output: 0-18VDC 
Current: 0-2A 

Source Effect:<0.02%+lmV 
Load Effect:<0.01% +5mV 
Ripple & Noise:<lmVrms 

'urchase 
OnLine 


5 ± 

$59.95 $52.95 

Item# CSI1802D 

Details at Web Site > Test Equipment 
> Power Supplies 



^ 13.8V, 6A DC Regulated 'N 
Power Supply 


f 5MHz Dual Channel Digital Scope Me ter A S' Circuit Specialists 20MHz Dual Trace ScopcA 

‘"""“""T - " Item# CSI6502 



"DC to 5MHz 
*Dual Channel 
*Sampleing Time:50Ms.S 
Turing 


Item# S2405 

$299.00 ! 


*16 shot reference w 
form & set-up memory 
*Built in autoranging True RMS 
Digital Multimeter 
includes RS-232 I.F. software, 
RS232 cable & Rubber Boot 


*20Mhz Bandwidth 
*Alt-Mag sweep 

*lmV/Div vertical i . 

sensitivity 

* Alternate trigger * j. " :■ : j ■ *1 

*X5 sweep magnification - o . u t 

*Large 6”CRT/autofocus 

*Comes w/2 (xl & xlO) probes) nn , 

Details at Web Site $269.00 . 

^^TestE^ui^ment^Oscillosco^es/Outstws^n^Price^^^^ 


Ideal for mobile tranceivers, high amp 
stepper motors and CNC machines. 
Details at Web Site . n. 

> Test Equipment 

^ > Power Supplies _S 

Innovative 5 in 1 DMM 

Integrated Sound/ _ 

Light/Humidity E ggg 

Sensors 

Item# CSI8209 

*Alt-Mag sweep 
1 mV/Div vertical 
sensitivity 
*Altemate trigger 
*X5 sweep magnification 
Details at Web Site <£49 QQ 

> Digital Multimeters/World Beater 


Non-Contact Infrared Thermometer 

*Non-contact Infrared w/laser pointer measures 
-*50°C to 500°C/-58°F to 932°F 
*Measure temperature of hot or moving objects 
from a safe distance 
*Narrow 8:1 field of’ 

'Fast Sampling Time 



Only 

"~.00 ! 


$79 


*Switchable C° to F° and Auto Power Off 
*Large 3-1/2 Digit (1999 count) backlit LCD 
with Data Hold 

Details at Web Site Item# DT-8812 

> Test Equipment 

> Infrared Non-Contact Digital Thermometers > 


RF Field Strength Analyzer 

New Fantastic 


Compare at Over $2000 ! |J 

Low Price: 


The 3201 is a high quality hand-held RF 

$1299! 



Field Strength Analyzer with wide band 
reception ranging from 100kHz to 
2060MHz.The 3201 is a compact & 
lightweight portable analyzer & is a mus 
for RF Technicians. Ideal for testing, 
installing & maintenance of Mobile 
Telephone Comm systems, Cellular 
Phones,Cordless phones, paging systems, 
cable &Satellite TV as well as antenna 
installations.May also be used to locate 

. Details at Web Site > 


♦WFM/NFM/AM/SSB modulated signals m 
be measured. 

*Signal Levels up to 160Channels ca 


*Built-in Frequency Counter ^ > 

*LED Backlight LCD (192x192 dots) 

♦All frictions are menu selected. 

♦RS232C with software for PC & printer interface 
♦Built-in speaker 

Item# 3201 (Limited Offer) 

Test Equipment > 2GHz RF Field Strength Analyzer 



Purchase Item# 988-D 

and get a 

FREE ! 

Smoke Absorber 


STANDARD FEATURES: 

♦Tip temperature accuracy to within ± 3 °C (6°F) 

♦Zero Voltage switching and fully grounded design 
♦Adjustable temperature w/o changing tips 
♦Controlled by a finger actuated, thyristor switching i 
♦Detachable solder and desolder wands for ease of use , 
♦A self-contained vacuum pump engineered to provide 
maintenance free operation 



A $35.00"' 

^ Value ! - 

e Supplies Last 

Only 

$399.00 ! 


exposure to solder fiimes 
Details at Web Site 


> Xytronic Soldering Equipr 


Circuit Specialists now carries 
FLLJKE . FLUKE TEST EQUIPMENT 

Visit our web site & view New , 

our extensive offering of FLUKE COLOR SCOPES 

FLUKE TEST EQUIPMENT. 

High Performance Testers at Circuit Specialists Prices. 

^Ve’ve got Great deals ! Details at Web Site 


PROGRAMMABLE DC POWER SUPPLY 



| | Normal brightness LEDs now^available 

11 1 ice. Each bag contains 100 of the sc 




a RED, 
sizes. Your 
le LEDs. 


BAG-RED3MM $1.50 BAG-RED5MM $1.50 

BAG-GREEN3MM $1.50 BAG-GREEN5MM $1.50 

BAG-YELL! : ....$2.00 ...$2.00 


0 


;o.30 fc . 

, 5R3UT-2/R...5mm Red SB LED(3500maxMCD) 1+ $0.25 /10+ $0.20 /100+ $0.15 — 
’ 53BW3SCC08..5mmWMt®SBLED(3500maxMCD)l+ $1.69/10+ $1.49/100+ $1.18 ^ 
5Y3STC-2....5mm SB 1 (KM v 

Details at Web Site > Semiconductor Devices > LEDs, Displays & Lamps 


Item# CSI3645A 


’i lign Resolution ( i m v ) 

■PC compatible (with optional RS-232 adaptor module) 
f Easy programming w numeric keypad or fast rotary code 


Details at Web Site > Test Equipme 


Visit our website for a complete listing of our offers. We have over 8,000 electronic items on line @ www.CircuitSpecialists.com. PC based data acquisition, 
industrial computers, loads of test equipment, optics, I.C’s, transistors, diodes, resistors, potentiometers, motion control products, capacitors, miniature observation 
cameras, panel meters, chemicals for electronics, do it yourself printed circuit supplies for PCb fabrication, educational D.I.Y.kits, cooling fans, heat shrink, cable 
& other wire handleing items, hand tools for electronics, breadboards, trainers, programmers & much much more! Some Deals you won ’t believe! 


Circuit Specialists, Inc. 220 S. Country Club Dr., Mesa, AZ 85210 

800-528-1417 / 480-464-2485 / FAX: 480-464-5824 


y 







#90005 

E §}* 

% t 

\ Microco» tro 


parallax Summer 

■ . , har.k for an ,tiui r,mieC 


Order online 
the Parallax 
888 - 512-10